Sam-I-Am's Builder Blog

Work type stuff - handy urls and notes on the trials and tribulations of a web builder.

Thursday, October 21, 2004

CGI Debugging

This snippet from a thread on PerlMonks:

use CGI::Carp qw(fatalsToBrowser);
use diagnostics;
local $SIG{__WARN__} = \&Carp::cluck;

and this CGI Help Guide, also on PerlMonks...

#!/usr/bin/perl -wT

# ensure all fatals go to browser during debugging and set-up
# comment this BEGIN block out on production code for security
BEGIN {
    $|=1;
    print "Content-type: text/html\n\n";
    use CGI::Carp('fatalsToBrowser');
}

along with lots more good tips and tricks on that page.