Click here to get back home

Error reporting in CGI

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Error reporting in CGI daniel kaplan 05-19-2005
Posted by daniel kaplan on May 19, 2005, 9:41 pm
Please log in for more thread options


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...] myscript.pl: Global symbol "$x" requires explicit
packagename at pix.pl 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/www.mywebsite.com/web/cgi-bin/myscript.pl

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....

thanks




Posted by Sherm Pendley on May 19, 2005, 11:51 pm
Please log in for more thread options


daniel kaplan wrote:

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

Have a look at CGI::Carp.

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

use CGI::Carp qw(fatalsToBrowser);

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


Posted by daniel kaplan on May 20, 2005, 11:05 am
Please log in for more thread options



> In a nutshell, add this to the top of your script:
>
> use CGI::Carp qw(fatalsToBrowser);

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?




Similar ThreadsPosted
PayPal Reporting API January 10, 2007, 9:04 am
CPANPLUS test reporting problem November 11, 2004, 3:24 pm
Availability of a tool for database contents reporting September 7, 2004, 9:41 pm
Namespace Recommendation for Abuse Reporting Utilities Module February 26, 2006, 10:53 pm
Error: RCPT TO: error (550 relay not permitted) February 11, 2006, 1:39 pm
GD.c: 533: error: syntax error before "void" March 24, 2006, 10:15 am
Error while using LWP December 1, 2005, 8:06 am
Have I an error in my POD? December 21, 2005, 6:35 pm
Deparse error July 7, 2004, 2:52 am
Out of Memory error September 12, 2004, 11:51 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap