EOF not found

EOF not found

am 24.08.2007 03:22:26 von George

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

print sMail <<"EOMsg";
From: test\@test.net
To: test\@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

Re: EOF not found

am 24.08.2007 04:15:22 von Gunnar Hjalmarsson

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\@test.net
> To: test\@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

Re: EOF not found

am 23.09.2007 15:41:46 von banesong

On Aug 23, 9:22 pm, 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\@test.net
> To: test\@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 <
My experience has been that unless the termination string matches
exactly with the indicator after the <<, it will not be seen.

Thomas

Re: EOF not found

am 24.09.2007 23:18:31 von Jim Gibson

In article <1190554906.383356.187150@g4g2000hsf.googlegroups.com>,
banesong wrote:

> On Aug 23, 9:22 pm, 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\@test.net
> > To: test\@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 <
There should be no difference between 'print sMail < 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

Re: EOF not found

am 25.09.2007 01:09:57 von Jim Gibson

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

> In article <1190554906.383356.187150@g4g2000hsf.googlegroups.com>,
> banesong wrote:
>
> > On Aug 23, 9:22 pm, 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\@test.net
> > > To: test\@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 < >
> There should be no difference between 'print sMail < > 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