EOF not found

I an trying to use the following text in a CGI perl script; but I keep
getting an error:

print sMail <<"EOMsg";
From: test\ [at] test.net
To: test\ [at] test.net
Subject: Data
Soon to hold data.
EOMsg
close(sMail);

The error is: Can't find string terminator "EOMsg" anywhere before EOF.

I am editing the cgi file from a Windows system but "use UNIX Line
endings" is turned on, so it should not be a line termination issue.
Just to be sure I transfered the file by ASCII mode to the server and
still receive the same issue.

Thanks
George [ Fr, 24 August 2007 03:22 ] [ ID #1804413 ]

Re: EOF not found

George wrote:
> I an trying to use the following text in a CGI perl script; but I keep
> getting an error:
>
> print sMail <<"EOMsg";
> From: test\ [at] test.net
> To: test\ [at] test.net
> Subject: Data
> Soon to hold data.
> EOMsg
> close(sMail);

Note that you need a blank line between the headers and the body of the
message.

> The error is: Can't find string terminator "EOMsg" anywhere before EOF.
>
> I am editing the cgi file from a Windows system but "use UNIX Line
> endings" is turned on, so it should not be a line termination issue.
> Just to be sure I transfered the file by ASCII mode to the server and
> still receive the same issue.

Maybe an extra space character?

http://perldoc.perl.org/perlop.html#%3c%3cEOF-here-doc-hered oc-here-document-%3c%3c


--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Gunnar Hjalmarsson [ Fr, 24 August 2007 04:15 ] [ ID #1804414 ]

Re: EOF not found

On Aug 23, 9:22 pm, George <romans... [at] earthlink.net> wrote:
> I an trying to use the following text in a CGI perl script; but I keep
> getting an error:
>
> print sMail <<"EOMsg";
> From: test\ [at] test.net
> To: test\ [at] test.net
> Subject: Data
> Soon to hold data.
> EOMsg
> close(sMail);
>
> The error is: Can't find string terminator "EOMsg" anywhere before EOF.
>
> I am editing the cgi file from a Windows system but "use UNIX Line
> endings" is turned on, so it should not be a line termination issue.
> Just to be sure I transfered the file by ASCII mode to the server and
> still receive the same issue.
>
> Thanks

I would also recommend changing your print statement to remove the
quotes:

print sMail <<EOMsg;

My experience has been that unless the termination string matches
exactly with the indicator after the <<, it will not be seen.

Thomas
banesong [ So, 23 September 2007 15:41 ] [ ID #1827423 ]

Re: EOF not found

In article <1190554906.383356.187150 [at] g4g2000hsf.googlegroups.com>,
banesong <banesong [at] gmail.com> wrote:

> On Aug 23, 9:22 pm, George <romans... [at] earthlink.net> wrote:
> > I an trying to use the following text in a CGI perl script; but I keep
> > getting an error:
> >
> > print sMail <<"EOMsg";
> > From: test\ [at] test.net
> > To: test\ [at] test.net
> > Subject: Data
> > Soon to hold data.
> > EOMsg
> > close(sMail);
> >
> > The error is: Can't find string terminator "EOMsg" anywhere before EOF.
> >
> > I am editing the cgi file from a Windows system but "use UNIX Line
> > endings" is turned on, so it should not be a line termination issue.
> > Just to be sure I transfered the file by ASCII mode to the server and
> > still receive the same issue.
> >
> > Thanks
>
> I would also recommend changing your print statement to remove the
> quotes:
>
> print sMail <<EOMsg;

There should be no difference between 'print sMail <<EOMsg;' and 'print
sMail"EOMsg";' Double-quote context is the default for Here documents.
>
> My experience has been that unless the termination string matches
> exactly with the indicator after the <<, it will not be seen.

That is correct, but has nothing to do with the presence or absence of
quotes. However, the quotes let you see better what the termination
string is. For that reason, I would recommend leaving in the double
quotes.

--
Jim Gibson

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Jim Gibson [ Mo, 24 September 2007 23:18 ] [ ID #1828265 ]

Re: EOF not found

In article <240920071418316126%jgibson [at] mail.arc.nasa.gov>, Jim Gibson
<jgibson [at] mail.arc.nasa.gov> wrote:

> In article <1190554906.383356.187150 [at] g4g2000hsf.googlegroups.com>,
> banesong <banesong [at] gmail.com> wrote:
>
> > On Aug 23, 9:22 pm, George <romans... [at] earthlink.net> wrote:
> > > I an trying to use the following text in a CGI perl script; but I keep
> > > getting an error:
> > >
> > > print sMail <<"EOMsg";
> > > From: test\ [at] test.net
> > > To: test\ [at] test.net
> > > Subject: Data
> > > Soon to hold data.
> > > EOMsg
> > > close(sMail);
> > >
> > > The error is: Can't find string terminator "EOMsg" anywhere before EOF.
> > >
> > > I am editing the cgi file from a Windows system but "use UNIX Line
> > > endings" is turned on, so it should not be a line termination issue.
> > > Just to be sure I transfered the file by ASCII mode to the server and
> > > still receive the same issue.
> > >
> > > Thanks
> >
> > I would also recommend changing your print statement to remove the
> > quotes:
> >
> > print sMail <<EOMsg;
>
> There should be no difference between 'print sMail <<EOMsg;' and 'print
> sMail"EOMsg";' Double-quote context is the default for Here documents.

Sorry, meant 'print sMail <<"EOMsg";', of course.

> >
> > My experience has been that unless the termination string matches
> > exactly with the indicator after the <<, it will not be seen.
>
> That is correct, but has nothing to do with the presence or absence of
> quotes. However, the quotes let you see better what the termination
> string is. For that reason, I would recommend leaving in the double
> quotes.

--
Jim Gibson

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Jim Gibson [ Di, 25 September 2007 01:09 ] [ ID #1829081 ]
Perl » alt.perl » EOF not found

Vorheriges Thema: Quoting string array in Join?
Nächstes Thema: file permissions with cgi script