The one thing i really learned from my compiler class in college was that one should always be thankful of any error message one receives from the compiler (interpreter). Sometimes you just can't get an exact error message. Sometimes you just have to remind yourself that an error message is just a clue, and you have to play detective.

How about this error: my $test = 1 / 0;. CGI::Carp tells us:

Illegal division by zero at ... line 9.
How about this error:
my $array = 1; foreach (%$array) { print } #error: Can't use string ("1") as a HASH ref while "strict refs" in use at ... + line 11.
Notice how in both of those errors, we were never informed of which variables were the culprits? That's because revealing such info to the user is a security hazard.

However, why it won't tell us the line that the error occured on for an undeclared variable, I don't know. I would think that since the other two examples informed us of which line to look at, your error should to. My guess as to why is because the name of the variable is included in the error message that tells the line number.

The solution - always use the error log. And if you can't access the error log - comment out 'use CGI::Carp' and run perl -c on your cgi script. Note that this won't inform us of the 'HASH ref while "strict refs"' error from my second example - to catch run-time errors, run your cgi script on the command line. TIMTOWTDI!

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)

In reply to (jeffa) Re: CGI::Carp won't send fatalsToBrowser by jeffa
in thread CGI::Carp won't send fatalsToBrowser by George_Sherston

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.