Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: consistent form mail error: premature end of script headers

by HamNRye (Monk)
on Jan 17, 2003 at 21:41 UTC ( [id://227809]=note: print w/replies, xml ) Need Help??


in reply to consistent form mail error: premature end of script headers

I have checked the script and it appears OK. However, it does not appear to be a decade out of date. Written in 1997 by James Marshall, james@jmarshall.com

The 500 server error is common for newbies... Are you sure you FTP'ed it correctly??

The script won't run? Check the "here-documents", which look something like this:

# Similar code appears on line 59 of mailer.pl print << "END"; Hello World! END

The quoted token ("END" in this example, or whatever is used in your script) must EXACTLY match the token that terminates the text. It may look OK to you, but if you've moved the file from DOS/Windows to UNIX, remember that UNIX uses <LF> to delimit lines and DOS/Windows uses <CR><LF>. What that means to Perl is that there is an invisible <CR> in the end token, but there isn't one in the quoted token. Guess what? They don't match, at least in Perl's opinion. Make sure that the end token is flush on the left margin with a <LF> following it - and no trailing space or hidden <CR> on the line.

The easiest way to do this is to simply hit the Return key right after the end token, whether it needs it or not. That way you'll know its the right line delimiter for your system. <Checking the script on your system, the script cannot even report that it recieved no arguments (first part of the routine.) My guess is that you have uploaded the script improperly.

Another tool in the debugging arsenal is to use CGI::Carp. Its now part of the standard Perl distribution, but if you have an earlier version you can download it from CPAN.

Somewhere near the top of your script type use CGI::Carp qw(fatalsToBrowser);

This will redirect all fatal error messages to your browser, so you have a better idea of what is going wrong.

If nothing else, adding the Carp line to your program will help the monks better determine what is not happening.

~Hammy

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://227809]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-23 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found