[Kc] CGI error messages on no-frills ISPs

Garrett Goebel garrett at scriptpro.com
Wed Aug 13 14:56:03 CDT 2003


Last night CJ asked what he could do to get better error output for CGI
scripts when running scripts on barebones no-frills ISPs...

Here's the stuff to put at the top of your CGI scripts to enable graceful
error messages. I'm taking it directly from ch3, p108 of the "Official Guide
to Programming with CGI.pm"

#!/usr/bin/perl
use CGI;
use CGI::Carp qw(fatalsToBrowser carpout);
open (LOG, ">>/home/youraccount/logs/cgi_errors.log")
  or die "couldn't open log file: $!";
carpout(LOG);

The effects of these statements will be to log warnings and other nonfatal
error messages to a file. Fatal errors, in addition to being sent to the
file will appear in the browser window.

--
Garrett Goebel
IS Development Specialist

ScriptPro                  Direct: 913.403.5261
5828 Reeds Road            Main:   913.384.1008
Mission, KS 66202          Fax:    913.384.2180
www.scriptpro.com          garrett at scriptpro dot com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20030813/f259226e/attachment.htm


More information about the kc mailing list