Error reporting in CGI

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Still new to Perl so this might be a dumb question.  The error reporting
when a script has errors is different when I run it in Perl from a command
prompt, or from Perl in a browser (off of my Linux server).

So where as in the command prompt off of my machine I'll get this:

[..time stamp...] Global symbol "$x" requires explicit
packagename at line 64.

When I run the same script (via browser) I get:

[..time stamp...]  [error] [client --IP ADDRESS--] Premature end of script
headers: /home/sites/

is there anything i can do withint the CGI module to make the first appear
in either the errorlog or in the browser?

not even sure this is solvable by module, but figured i could ask....


Re: Error reporting in CGI

daniel kaplan wrote:

Quoted text here. Click to load it

Have a look at CGI::Carp.

In a nutshell, add this to the top of your script:

     use CGI::Carp qw(fatalsToBrowser);


Cocoa programming in Perl:
Hire me! My resume:

Re: Error reporting in CGI

Quoted text here. Click to load it

Thanks Sherm, I have that in all my scripts, thinking that was the ticket.
But since it didn't do it upon furhter reading I realized it works with "the
standard warn(), die (), croak(), confess() and carp() calls will
automagically be replaced with functions that write out nicely time-stamped
messages to the HTTP server error log."

Actually now that I think about it, not declaring $x before using it woudl
be a compile time error (with my minimal knowledge of Perl) and am asking
this in the wrong newsgroup?

Site Timeline