Oh Benevolent Monks,

I'm having a problem with my CGI scripts on a Linux box I never use. When I get an error in a Perl CGI script, it prints the error to STDOUT instead of STDERR. Thus, when I run a script that has a trivial error (Use of uninitialized value in concatenation ...), it is printed as the first line, thus generating a Premature End of Script Headers error in the Apache error_log.

Now, I know I can put a BEGIN {} block in to flush the STDOUT handle, or use CGI::Carp to the same effect, but on my own box, as well as most development boxes I've used, the CGI errors (specifically, the perl errors) are flushed to STDERR, and thus handled by Apache. A friend of mine seems to think it's a Perl setting, and I couldn't find anything about it scouring the Apache lists. Any thoughts?

Environment: Mandrake 8.1, most packages installed by RPM, Perl 5.6.1 installed by CPAN.

Thanks ever so much,
Ismail

In reply to Perl CGI errors to apache/error_log by ismail

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.