<!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 &quot;Official Guide to Programming with CGI.pm&quot;</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, &quot;&gt;&gt;/home/youraccount/logs/cgi_errors.log&quot;)</FONT>
<BR><FONT SIZE=2>&nbsp; or die &quot;couldn't open log file: $!&quot;;</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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Direct: 913.403.5261</FONT>
<BR><FONT SIZE=2>5828 Reeds Road&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Main:&nbsp;&nbsp; 913.384.1008</FONT>
<BR><FONT SIZE=2>Mission, KS 66202&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fax:&nbsp;&nbsp;&nbsp; 913.384.2180</FONT>
<BR><FONT SIZE=2>www.scriptpro.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; garrett at scriptpro dot com</FONT>
</P>

</BODY>
</HTML>