I've been playing with a script that jeffa wrote, CGI mailto via code reuse (AKA the CPAN). And I can't seem to get it to work. The script is identical to what jeffa wrote, with the exception of changing the email addresses. But running this through Apache 1.3.28 I keep getting "premature end of headers" in my error.log.

I've tried adding a $|++; with no change in results. When I run this from the command line I'm getting HTML output. Suggestions more than welcome.

The output of the script from the command line:
Content-Type: text/html; charset=ISO-8859-1 <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"><head><title>The Form</title> </head><body> <form method="post" action="/mail_it.cgi" enctype="application/x-www-f +orm-urlencoded"> name: <input type="text" name="name" /><br /> email: <input type="text" name="email" /><br /> address1: <input type="text" name="address1" /><br /> address2: <input type="text" name="address2" /><br /> city: <input type="text" name="city" /><br /> state: <input type="text" name="state" /><br /> zip: <input type="text" name="zip" /><br /> homephone: <input type="text" name="homephone" /><br /> workphone: <input type="text" name="workphone" /><br /> business: <input type="text" name="business" /><br /> goals: <input type="text" name="goals" /><br /> comments: <input type="text" name="comments" /><br /> <input type="submit" name="mail_it" value="mail_it" /><div></div></for +m></body></html>

Everything appears to be working correctly. But either Apache doesn't like this, or the CGI header isn't working like I'd expect.

While I think this is probably an Apache problem, I'm not clear enough on my CGI to be able to point definitively to it. Note that I have successfully created other CGI scripts without this problem. So it seems that CGI is horking on complicated scripts but working fine for straightforward scripts.

What am I overlooking? Which M should I be RTFing?


In reply to CGI Header problem/question by Nkuvu

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.