...maybe a module you've starting using is redirecting STDERR to nul (/dev/null)?

I don't think that's it because if I remove the syntax errors so that the code works again, and then call

print STDERR "hello world.\n";

It prints exactly as expected. If stderr were redirected, then I wouldn't see that.

Besides, that shouldn't matter: if my code is redirecting STDERR, and there are syntax errors that causes the perl interpreter to terminate execution, that should write to my terminal regardless of where my code's perception of STDERR is, right? If not, you could really screw yourself up.

However, you raise an intereseting point: a possible source of confusion could be the CARP package, which has a BEGIN block and redirects STDERR for debugging cgi scripts (where there is no terminal to output to). I do include a module that has that, but as I said, this was never a problem before. Nothing's changed, unless there has been a reordering of use lines that include packages. Does order matter for stuff like that? Since I have this problem now, but didn't before, that might answer my own question. It might have been that the CARP package from some module was being masked.

I'll pre-empt someone's potential answer that might say, "don't do that" with a question: Can a module do that? (ie., a module use CARP to redirect stderr) Is it better/more appropriate/"blessed" to never have modules do that, and instead keep those in the main package?


In reply to Re^2: no error messages for syntax errors? by argv
in thread no error messages for syntax errors? by argv

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.