Can't find string terminator ...

Discussion in 'Perl Misc' started by Trudge, Oct 23, 2006.

  1. Trudge

    Trudge Guest

    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.
    --
     
    Trudge, Oct 23, 2006
    #1
    1. Advertising

  2. Trudge

    John Bokma Guest

    "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/
     
    John Bokma, Oct 23, 2006
    #2
    1. Advertising

  3. Trudge

    Amer Neely Guest

    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!"
     
    Amer Neely, Oct 23, 2006
    #3
  4. Trudge

    John Bokma Guest

    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/
     
    John Bokma, Oct 23, 2006
    #4
  5. Trudge

    Amer Neely Guest

    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!"
     
    Amer Neely, Oct 23, 2006
    #5
  6. Trudge

    Amer Neely Guest

    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!"
     
    Amer Neely, Oct 23, 2006
    #6
  7. Trudge

    Guest

    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
     
    , Oct 23, 2006
    #7
  8. Trudge

    Amer Neely Guest

    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!"
     
    Amer Neely, Oct 23, 2006
    #8
  9. Trudge

    Tintin Guest

    "Trudge" <> wrote in message
    news:...
    > 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
     
    Tintin, Oct 23, 2006
    #9
  10. Trudge

    Guest

    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
     
    , Oct 23, 2006
    #10
  11. Trudge

    Amer Neely Guest

    Tintin wrote:
    > "Trudge" <> wrote in message
    > news:...
    >> 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?


    Hmmm. This is interesting. I loaded the file as a binary into TextPad,
    and there is 0D 0D 0A after the final 't'. So an extra line-feed seems
    to have crept in there.

    Good call :) Now to fix the bloody problem.

    --
    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!"
     
    Amer Neely, Oct 23, 2006
    #11
  12. Trudge

    Amer Neely Guest

    wrote:
    > 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
    >

    Thanks.
    Got it:
    D:\httpd\cgi-bin\hasbeans\dev>perl -0777 -ne "print ord,qq{\t$_\n}
    foreach split //" test.pl
    35 #
    33 !
    32
    47 /
    117 u
    115 s
    114 r
    47 /
    98 b
    105 i
    110 n
    47 /
    112 p
    101 e
    114 r
    108 l
    32
    45 -
    119 w
    13
    10

    66 B
    69 E
    71 G
    73 I
    78 N
    13
    10

    123 {
    13
    10

    9
    111 o
    112 p
    101 e
    110 n
    32
    40 (
    83 S
    84 T
    68 D
    69 E
    82 R
    82 R
    44 ,
    34 "
    62 >
    62 >
    36 $
    48 0
    45 -
    101 e
    114 r
    114 r
    46 .
    116 t
    120 x
    116 t
    34 "
    41 )
    59 ;
    13
    10

    9
    112 p
    114 r
    105 i
    110 n
    116 t
    32
    83 S
    84 T
    68 D
    69 E
    82 R
    82 R
    32
    34 "
    92 \
    110 n
    34 "
    44 ,
    115 s
    99 c
    97 a
    108 l
    97 a
    114 r
    32
    108 l
    111 o
    99 c
    97 a
    108 l
    116 t
    105 i
    109 m
    101 e
    44 ,
    34 "
    92 \
    110 n
    34 "
    59 ;
    13
    10

    125 }
    13
    10

    117 u
    115 s
    101 e
    32
    100 d
    105 i
    97 a
    103 g
    110 n
    111 o
    115 s
    116 t
    105 i
    99 c
    115 s
    59 ;
    13
    10

    112 p
    114 r
    105 i
    110 n
    116 t
    32
    34 "
    67 C
    111 o
    110 n
    116 t
    101 e
    110 n
    116 t
    45 -
    116 t
    121 y
    112 p
    101 e
    58 :
    116 t
    101 e
    120 x
    116 t
    47 /
    112 p
    108 l
    97 a
    105 i
    110 n
    92 \
    110 n
    92 \
    110 n
    34 "
    59 ;
    13
    10

    112 p
    114 r
    105 i
    110 n
    116 t
    32
    113 q
    113 q
    123 {
    119 w
    116 t
    102 f
    125 }
    59 ;
    13
    10

    112 p
    114 r
    105 i
    110 n
    116 t
    32
    60 <
    60 <
    69 E
    110 n
    100 d
    84 T
    101 e
    120 x
    116 t
    59 ;
    13
    10

    119 w
    116 t
    102 f
    13
    10

    69 E
    110 n
    100 d
    84 T
    101 e
    120 x
    116 t
    13
    10


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

    I see the CR-LF pair, but should there also be that blank line between
    blocks?

    --
    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!"
     
    Amer Neely, Oct 23, 2006
    #12
  13. Trudge

    Amer Neely Guest

    Amer Neely wrote:
    > Tintin wrote:
    >> "Trudge" <> wrote in message
    >> news:...
    >>> 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?

    >
    > Hmmm. This is interesting. I loaded the file as a binary into TextPad,
    > and there is 0D 0D 0A after the final 't'. So an extra line-feed seems
    > to have crept in there.
    >
    > Good call :) Now to fix the bloody problem.
    >


    Well, I've solved the problem, but it is the weirdest thing I've seen.

    In TextPad my default font was verdana. I switched that to courier. Then
    copied the code from my test.pl file. Deleted that file, then into a new
    file I pasted the code, but now in the new font. Voila. Unbelievable but
    true.

    --
    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!"
     
    Amer Neely, Oct 24, 2006
    #13
  14. Trudge

    Amer Neely Guest

    Michele Dondi wrote:
    > On Mon, 23 Oct 2006 16:42:52 -0400, Amer Neely
    > <> wrote:
    >
    >>> 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.

    >
    > Not to distrust you, but what about cat -A?
    >
    >
    > Michele


    Hmm. That looks like a *nix command, but I'm running on Windoze 2K. I
    did solve the immediate problem as posted, but it still doesn't answer
    why this situation arose in the first place. I guess I'll never know.

    --
    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!"
     
    Amer Neely, Oct 24, 2006
    #14
  15. Trudge

    John Bokma Guest

    Amer Neely <> wrote:

    > Hmm. That looks like a *nix command, but I'm running on Windoze 2K. I
    > did solve the immediate problem as posted, but it still doesn't answer
    > why this situation arose in the first place. I guess I'll never know.


    I recall that you wrote that there was an additional \x0a in your code.

    Furthermore, you can install cat, ls, grep, wget, etc. [1] on a computer
    running Windows 2000 (If you don't like Windows, and need to call it
    Windoze, why are you using it in the first place?)

    [1] http://johnbokma.com/mexit/2006/07/01/

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

    Perl help, tutorials, and examples: http://johnbokma.com/perl/
     
    John Bokma, Oct 24, 2006
    #15
  16. Trudge

    Guest

    Amer Neely <> wrote:
    > wrote:
    > >
    > > perl -0777 -ne "print ord, qq{\t$_\n} foreach split //" eot.pl
    > >
    > > (and change. eot.pl to whatever file name you acutally used)
    > >
    > > Xho
    > >

    > Thanks.
    > Got it:
    > D:\httpd\cgi-bin\hasbeans\dev>perl -0777 -ne "print ord,qq{\t$_\n}
    > foreach split //" test.pl



    ....
    > 119 w
    > 116 t
    > 102 f
    > 13
    > 10
    >
    > 69 E
    > 110 n
    > 100 d
    > 84 T
    > 101 e
    > 120 x
    > 116 t
    > 13
    > 10
    >
    > D:\httpd\cgi-bin\hasbeans\dev>
    >
    > I see the CR-LF pair, but should there also be that blank line between
    > blocks?


    Yes, becuase I print both the ord and the $_ itself. Printing the $_
    when $_ contains chr(10) is what is causing the blank lines. You could
    make is supress the printing of $_ (but still print ord($_)) when $_ is not
    an ordinary character, but I'm too lazy.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Oct 24, 2006
    #16
  17. Trudge

    Amer Neely Guest

    John Bokma wrote:
    > Amer Neely <> wrote:
    >
    >> Hmm. That looks like a *nix command, but I'm running on Windoze 2K. I
    >> did solve the immediate problem as posted, but it still doesn't answer
    >> why this situation arose in the first place. I guess I'll never know.

    >
    > I recall that you wrote that there was an additional \x0a in your code.
    >
    > Furthermore, you can install cat, ls, grep, wget, etc. [1] on a computer
    > running Windows 2000 (If you don't like Windows, and need to call it
    > Windoze, why are you using it in the first place?)
    >
    > [1] http://johnbokma.com/mexit/2006/07/01/
    >

    Yeah it's a love-hate thing. I've run a dual-boot with mandrake for a
    while but so many of the other apps I use are Windows-based. And I could
    never get wine to run TextPad. But I really should get more experience
    with linux.

    I do have awk and grep available but never thought of cat.

    --
    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!"
     
    Amer Neely, Oct 24, 2006
    #17
  18. Trudge

    Thrill5 Guest

    "Amer Neely" <> wrote in message
    news:SQb%g.172875$...
    > Amer Neely wrote:
    >> Tintin wrote:
    >>> "Trudge" <> wrote in message
    >>> news:...
    >>>> 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?

    >>
    >> Hmmm. This is interesting. I loaded the file as a binary into TextPad,
    >> and there is 0D 0D 0A after the final 't'. So an extra line-feed seems to
    >> have crept in there.
    >>
    >> Good call :) Now to fix the bloody problem.
    >>

    >
    > Well, I've solved the problem, but it is the weirdest thing I've seen.
    >
    > In TextPad my default font was verdana. I switched that to courier. Then
    > copied the code from my test.pl file. Deleted that file, then into a new
    > file I pasted the code, but now in the new font. Voila. Unbelievable but
    > true.
    >
    > --
    > Amer Neely


    I had a similar experience once before with an extra "0x0d" characters in a
    small script I was working on, and I have never used the above text editor,
    but with "notepad.exe". I found it pretty quickly using "Wordpad.exe". I
    loaded up the script in WordPad because I know from experience that it will
    either fix, or display any funky characters in a text file. (It will
    successfully load unix text files, and covert them to cr-lf format after
    saving) Each line had an offending "0x0d" on the end which showed up in
    WordPad as a funky character at the end of each line.

    Scott
     
    Thrill5, Oct 25, 2006
    #18
  19. Trudge

    Amer Neely Guest

    Thrill5 wrote:
    > "Amer Neely" <> wrote in message
    > news:SQb%g.172875$...
    >> Amer Neely wrote:
    >>> Tintin wrote:
    >>>> "Trudge" <> wrote in message
    >>>> news:...
    >>>>> 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?
    >>> Hmmm. This is interesting. I loaded the file as a binary into TextPad,
    >>> and there is 0D 0D 0A after the final 't'. So an extra line-feed seems to
    >>> have crept in there.
    >>>
    >>> Good call :) Now to fix the bloody problem.
    >>>

    >> Well, I've solved the problem, but it is the weirdest thing I've seen.
    >>
    >> In TextPad my default font was verdana. I switched that to courier. Then
    >> copied the code from my test.pl file. Deleted that file, then into a new
    >> file I pasted the code, but now in the new font. Voila. Unbelievable but
    >> true.
    >>
    >> --
    >> Amer Neely

    >
    > I had a similar experience once before with an extra "0x0d" characters in a
    > small script I was working on, and I have never used the above text editor,
    > but with "notepad.exe". I found it pretty quickly using "Wordpad.exe". I
    > loaded up the script in WordPad because I know from experience that it will
    > either fix, or display any funky characters in a text file. (It will
    > successfully load unix text files, and covert them to cr-lf format after
    > saving) Each line had an offending "0x0d" on the end which showed up in
    > WordPad as a funky character at the end of each line.
    >
    > Scott
    >


    TP has configuration capabilities to use DOS, Unix, or Mac end-of-line
    characters but I've never run into this problem before. What is still
    weird is that a change of font should make a difference, as you say. It
    seems more likely to be an artifact of something else. Notepad has some
    quirky behaviour as well. Try this:
    1. Open Notepad
    2. Type the text "this app can break" (without quotes)
    3. Save the file
    4. Re-open the file in Notepad


    --
    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!"
     
    Amer Neely, Oct 25, 2006
    #19
  20. Trudge

    Solipsis Guest

    Trudge,


    Silly question. Is this happening after you ftp the files to the *nix
    box? Or before?
     
    Solipsis, Oct 25, 2006
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Hirschfield

    Help: asyncore/asynchat and terminator string

    David Hirschfield, Jan 16, 2007, in forum: Python
    Replies:
    0
    Views:
    333
    David Hirschfield
    Jan 16, 2007
  2. dbtouch
    Replies:
    32
    Views:
    3,280
    Jerry Coffin
    Mar 8, 2009
  3. TP
    Replies:
    4
    Views:
    157
    Tad McClellan
    Feb 14, 2004
  4. TP
    Replies:
    1
    Views:
    153
    Bob Walton
    Feb 11, 2004
  5. Replies:
    3
    Views:
    183
    Joe Smith
    Jul 17, 2005
Loading...

Share This Page