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


In reply to Re: consistent form mail error: premature end of script headers by HamNRye
in thread consistent form mail error: premature end of script headers by edahm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.