<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>CGI error messages on no-frills ISPs</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Last night CJ asked what he could do to get better error output for CGI scripts when running scripts on barebones no-frills ISPs...</FONT></P>
<P><FONT SIZE=2>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"</FONT></P>
<P><FONT SIZE=2>#!/usr/bin/perl</FONT>
<BR><FONT SIZE=2>use CGI;</FONT>
<BR><FONT SIZE=2>use CGI::Carp qw(fatalsToBrowser carpout);</FONT>
<BR><FONT SIZE=2>open (LOG, ">>/home/youraccount/logs/cgi_errors.log")</FONT>
<BR><FONT SIZE=2> or die "couldn't open log file: $!";</FONT>
<BR><FONT SIZE=2>carpout(LOG);</FONT>
</P>
<P><FONT SIZE=2>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.</FONT></P>
<P><FONT SIZE=2>--</FONT>
<BR><FONT SIZE=2>Garrett Goebel</FONT>
<BR><FONT SIZE=2>IS Development Specialist</FONT>
</P>
<P><FONT SIZE=2>ScriptPro Direct: 913.403.5261</FONT>
<BR><FONT SIZE=2>5828 Reeds Road Main: 913.384.1008</FONT>
<BR><FONT SIZE=2>Mission, KS 66202 Fax: 913.384.2180</FONT>
<BR><FONT SIZE=2>www.scriptpro.com garrett at scriptpro dot com</FONT>
</P>
</BODY>
</HTML>