in reply to Re^2: Testing scripts
in thread Testing scripts

Running under my windows command line on my machine my simple scripts work fine.
However so far I have found that
print <<"ending_print_tag";
blaaa blaaa
ending_print_tag
returns a "can't fint string terminator error "ending_print_tag" anywhere before EOF"
Any chance you would know what this means?
BTW this is my current level, gradually improving!

Replies are listed 'Best First'.
Re^4: Testing scripts
by Corion (Patriarch) on Feb 12, 2010 at 14:33 UTC

    Maybe you don't have a newline after ending_print_tag? Otherwise, please show the full code that exhibits that behaviour, and please put it in between <code>...</code> tags so it renders and downloads nicely.

      Ok, thanks for your prompt reply here.
      Any ideas?
      #!/usr/local/bin/perl print"Content-type:text/html\n\n"; print<<"ending_print_tag"; <html> <head> <title>My first CGI</title> <background="#oooooo" text='#FF0000"> </head> <body> <h1>My First CGI</h1> <em>HELLO, INTERNET!</em> <hr noshade> Watch our cyber space, another programmer is on the loose ;-) </body> </html> ending_print_tag

        Did you follow my advice of making sure that there is a newline at the end of your file?

        Your code works for me if it has a newline at the end, and it fails like you described if it does not have a newline at the end. One way to also make it work is to add a comment at the end of the file:

        #!/usr/local/bin/perl print"Content-type:text/html\n\n"; print<<"ending_print_tag"; <html> <head> <title>My first CGI</title> <background="#oooooo" text='#FF0000"> </head> <body> <h1>My First CGI</h1> <em>HELLO, INTERNET!</em> <hr noshade> Watch our cyber space, another programmer is on the loose ;-) </body> </html> ending_print_tag # This is the end of the file and to make sure that we have a newline +after the end of the # here-doc marker.
        Double-check your host's docs for any information about the location of their perl binary. There's a strong chance that it may be at /usr/bin/perl rather than /usr/local/bin/perl, since it would have been installed as part of the operating system instead of a "local" addition. If that path is wrong, then it doesn't matter if your Perl is perfect because the web server process won't be able to find the perl binary to execute it.