Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Can't find string terminator ...

Reply
Thread Tools

Can't find string terminator ...

 
 
Trudge
Guest
Posts: n/a
 
      10-23-2006
This is driving me crazy. I've been programming Perl for several years,
and love the 'here' document capability. I know how it works, and use
it in almost every script I write. I've done the Google group search
and read most of the postings, but no answers to my particular problem.

My development environment is Windows 2000 Pro, running Apache (1.3.29
and 2.0.52) and ActiveState Perl 5.x. I've been developing under this
scenario for a couple of years. I use TextPad as my editor. I haven't
made any changes to anything in the environment. Most of my scripts end
up on *nix boxes, and they all work just fine there.

Lately I noticed this on my home machine when running a test script:
Can't find string terminator "EndOfText" anywhere before EOF at test.pl
line 12 (#1)
(F) Perl strings can stretch over multiple lines. This message
means
that the closing delimiter was omitted. Because bracketed quotes
count
nesting levels, the following is missing its final parenthesis:

print q(The character '(' starts a side comment.);

If you're getting this error from a here-document, you may have
included
unseen whitespace before or after your closing tag. A good
programmer's
editor will have a way to help you find these characters.

Uncaught exception from user code:
Can't find string terminator "EndOfText" anywhere before EOF at
test.pl line 12.
at test.pl line 12

Here's the code:
#! /usr/bin/perl -w
BEGIN
{
open (STDERR,">>$0-err.txt");
print STDERR "\n",scalar localtime,"\n";
}

use diagnostics;

print "Content-type:text/plain\n\n";

print <<EndOfText;
Why doesn't this work?
EndOfText

I've checked this for syntax umpteen times and can't find anything
wrong. There is a hard-return after 'EndOfText' and it is at the left
margin. I run it through the server in a browser window and from the
command line, but still get the same result.

It's like an EOF character is buried in there somewhere. Which leads me
to wonder if TextPad has been corrupted to save files in a funky format
or something.

Anyone that has any ideas on this would you please respond either here
(for the rest of the group) and/or to my personal email.

Thanks.
--

 
Reply With Quote
 
 
 
 
John Bokma
Guest
Posts: n/a
 
      10-23-2006
"Trudge" <> wrote:

> print <<EndOfText;
> Why doesn't this work?
> EndOfText


Put the cursor just after the t and press return.

Configure your editor to trim tailing spaces/tabs. (Textpad can do this).

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/
 
Reply With Quote
 
 
 
 
Amer Neely
Guest
Posts: n/a
 
      10-23-2006
John Bokma wrote:
> "Trudge" <> wrote:
>
>> print <<EndOfText;
>> Why doesn't this work?
>> EndOfText

>
> Put the cursor just after the t and press return.
>
> Configure your editor to trim tailing spaces/tabs. (Textpad can do this).
>


Did both. Still get the same results.

--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
Perl | MySQL programming for all data entry forms.
"We make web sites work!"
 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      10-23-2006
Amer Neely <> wrote:

> John Bokma wrote:
>> "Trudge" <> wrote:
>>
>>> print <<EndOfText;
>>> Why doesn't this work?
>>> EndOfText

>>
>> Put the cursor just after the t and press return.
>>
>> Configure your editor to trim tailing spaces/tabs. (Textpad can do
>> this).
>>

>
> Did both. Still get the same results.



C:\Documents and Settings\John\My Documents>eot.pl
Why doesn't this work?

C:\Documents and Settings\John\My Documents>type eot.pl
print <<EndOfText;
Why doesn't this work?
EndOfText

C:\Documents and Settings\John\My Documents>

You're sure there is a newline after EndOfText?

Might be that you have accidently pressed a key combination that inserts a
hidden character in your terminator. I would delete EndOfText (twice), and
type it in again (once), and copy it.

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/
 
Reply With Quote
 
Amer Neely
Guest
Posts: n/a
 
      10-23-2006
John Bokma wrote:
> Amer Neely <> wrote:
>
>> John Bokma wrote:
>>> "Trudge" <> wrote:
>>>
>>>> print <<EndOfText;
>>>> Why doesn't this work?
>>>> EndOfText
>>> Put the cursor just after the t and press return.
>>>
>>> Configure your editor to trim tailing spaces/tabs. (Textpad can do
>>> this).
>>>

>> Did both. Still get the same results.

>
>
> C:\Documents and Settings\John\My Documents>eot.pl
> Why doesn't this work?
>
> C:\Documents and Settings\John\My Documents>type eot.pl
> print <<EndOfText;
> Why doesn't this work?
> EndOfText
>
> C:\Documents and Settings\John\My Documents>
>
> You're sure there is a newline after EndOfText?
>
> Might be that you have accidently pressed a key combination that inserts a
> hidden character in your terminator. I would delete EndOfText (twice), and
> type it in again (once), and copy it.
>


Believe me, I've tried everything I can think of to ensure there is
nothing else on that line except the newline at the end. There is
something very strange going on here.

--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
v: 705.223.3539
Perl | MySQL programming for all data entry forms.
"We make web sites work!"
 
Reply With Quote
 
Amer Neely
Guest
Posts: n/a
 
      10-23-2006
Amer Neely wrote:
> John Bokma wrote:
>> Amer Neely <> wrote:
>>
>>> John Bokma wrote:
>>>> "Trudge" <> wrote:
>>>>
>>>>> print <<EndOfText;
>>>>> Why doesn't this work?
>>>>> EndOfText
>>>> Put the cursor just after the t and press return.
>>>>
>>>> Configure your editor to trim tailing spaces/tabs. (Textpad can do
>>>> this).
>>> Did both. Still get the same results.

>>
>>
>> C:\Documents and Settings\John\My Documents>eot.pl
>> Why doesn't this work?
>>
>> C:\Documents and Settings\John\My Documents>type eot.pl
>> print <<EndOfText;
>> Why doesn't this work?
>> EndOfText
>>
>> C:\Documents and Settings\John\My Documents>
>>
>> You're sure there is a newline after EndOfText?
>>
>> Might be that you have accidently pressed a key combination that
>> inserts a hidden character in your terminator. I would delete
>> EndOfText (twice), and type it in again (once), and copy it.
>>

>
> Believe me, I've tried everything I can think of to ensure there is
> nothing else on that line except the newline at the end. There is
> something very strange going on here.
>


I checked the apache logs and get a slightly different error:
[Mon Oct 23 16:45:12 2006] [error] [client 127.0.0.1] Premature end of
script headers: d:/httpd/cgi-bin/hasbeans/dev/test.pl


--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
v: 705.223.3539
Perl | MySQL programming for all data entry forms.
"We make web sites work!"
 
Reply With Quote
 
xhoster@gmail.com
Guest
Posts: n/a
 
      10-23-2006
Amer Neely <> wrote:
>
> Believe me, I've tried everything I can think of to ensure there is
> nothing else on that line except the newline at the end. There is
> something very strange going on here.


perl -0777 -ne 'print ord, "\t$_\n" foreach split //' eot.pl

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
 
Reply With Quote
 
Amer Neely
Guest
Posts: n/a
 
      10-23-2006
wrote:
> Amer Neely <> wrote:
>> Believe me, I've tried everything I can think of to ensure there is
>> nothing else on that line except the newline at the end. There is
>> something very strange going on here.

>
> perl -0777 -ne 'print ord, "\t$_\n" foreach split //' eot.pl
>
> Xho
>

D:\httpd\cgi-bin\hasbeans\dev>perl -0777 -ne 'print ord,"\t$_\n" foreach
split //' test.pl
Can't find string terminator "'" anywhere before EOF at -e line 1.

D:\httpd\cgi-bin\hasbeans\dev>

--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
v: 705.223.3539
Perl | MySQL programming for all data entry forms.
"We make web sites work!"
 
Reply With Quote
 
Tintin
Guest
Posts: n/a
 
      10-23-2006

"Trudge" <> wrote in message
news: oups.com...
> This is driving me crazy. I've been programming Perl for several years,
> and love the 'here' document capability. I know how it works, and use
> it in almost every script I write. I've done the Google group search
> and read most of the postings, but no answers to my particular problem.
>
> My development environment is Windows 2000 Pro, running Apache (1.3.29
> and 2.0.52) and ActiveState Perl 5.x. I've been developing under this
> scenario for a couple of years. I use TextPad as my editor. I haven't
> made any changes to anything in the environment. Most of my scripts end
> up on *nix boxes, and they all work just fine there.
>
> Lately I noticed this on my home machine when running a test script:
> Can't find string terminator "EndOfText" anywhere before EOF at test.pl
> line 12 (#1)
> (F) Perl strings can stretch over multiple lines. This message
> means
> that the closing delimiter was omitted. Because bracketed quotes
> count
> nesting levels, the following is missing its final parenthesis:
>
> print q(The character '(' starts a side comment.);
>
> If you're getting this error from a here-document, you may have
> included
> unseen whitespace before or after your closing tag. A good
> programmer's
> editor will have a way to help you find these characters.
>
> Uncaught exception from user code:
> Can't find string terminator "EndOfText" anywhere before EOF at
> test.pl line 12.
> at test.pl line 12
>
> Here's the code:
> #! /usr/bin/perl -w
> BEGIN
> {
> open (STDERR,">>$0-err.txt");
> print STDERR "\n",scalar localtime,"\n";
> }
>
> use diagnostics;
>
> print "Content-type:text/plain\n\n";
>
> print <<EndOfText;
> Why doesn't this work?
> EndOfText
>
> I've checked this for syntax umpteen times and can't find anything
> wrong. There is a hard-return after 'EndOfText' and it is at the left
> margin. I run it through the server in a browser window and from the
> command line, but still get the same result.
>
> It's like an EOF character is buried in there somewhere. Which leads me
> to wonder if TextPad has been corrupted to save files in a funky format
> or something.


What is the hex or octal output of those last 3 lines?



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
xhoster@gmail.com
Guest
Posts: n/a
 
      10-23-2006
Amer Neely <> wrote:
> wrote:
> > Amer Neely <> wrote:
> >> Believe me, I've tried everything I can think of to ensure there is
> >> nothing else on that line except the newline at the end. There is
> >> something very strange going on here.

> >
> > perl -0777 -ne 'print ord, "\t$_\n" foreach split //' eot.pl
> >
> > Xho
> >

> D:\httpd\cgi-bin\hasbeans\dev>perl -0777 -ne 'print ord,"\t$_\n" foreach
> split //' test.pl
> Can't find string terminator "'" anywhere before EOF at -e line 1.


Yeah, you got to switch it to MSWindows CLI format:

perl -0777 -ne "print ord, qq{\t$_\n} foreach split //" eot.pl

(and change. eot.pl to whatever file name you acutally used)

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reverse a string with 0 terminator in one pass dbtouch C++ 32 03-08-2009 05:04 AM
Help: asyncore/asynchat and terminator string David Hirschfield Python 0 01-16-2007 11:05 PM
Can't find string terminator "EOM" - beginner question humphrey.c.chan@gmail.com Perl Misc 3 07-17-2005 12:03 PM
Perl : Cant Find String Terminator TP Perl Misc 4 02-14-2004 04:40 PM
PERL : Cant find string terminator .. TP Perl Misc 1 02-11-2004 11:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57