Sam-I-Am on Web Development

Sam Foster on the web and web-ish software developmen

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.

0 Comments:

<< Home