Try using this:
use CGI::Carp qw/fatalsToBrowser/;
sub cgierr{
my ($error, $nolog) = @_;
if ( $config{'debug'}==-1 ){
#### TBD: generic error report goes here
# return 1;
exit;
}
print $in->header();
#Begin detailed error and debug reporting
if ($config{'debug'}) {
print "<PRE>\n\nDEBUG\n=======================================
+===\n";
}
else {
print "<PRE>\n\nCGI ERROR\n===================================
+=======\n";
}
$error and print "Error Message : $error\n";
$0 and print "Script Location : $0\n";
$] and print "Perl Version : $]\n";
$random_variable_I_want_to_see and print "random variable I want
+to see : $random_variable_I_want_to_see\n";
print "\n\nInput Parameters\n-------------------------------------
+------\n";
foreach $key (sort $in->param) {
my $space = " " x (20 - length($key));
print "$key$space: " . $in->param($key) . "\n";
}
print "\nCookies\n-------------------------------------------\n";
print "\n$config{'userpass_cookie_name'} : " . $in->cookie($config
+{'userpass_cookie_name'});
print "\n$config{'userid_cookie_name'} : " . $in->cookie($config{'
+userid_cookie_name'});
print "\n$config{'back_do_cookie_name'} : " . $in->cookie($confi
+g{'back_do_cookie_name'});
print "\nEnvironment Variables\n----------------------------------
+---------\n";
foreach $env (sort keys %ENV) {
my $space = " " x (20 - length($env));
print "$env$space: $ENV{$env}\n";
}
print "\nStack Trace \n-------------------------------------------
+\n";
my $i = 0;
while (my ($file, $line, $sub) = (caller($i++))[1,2,3]) {
print qq!($sub) called from ($file) line ($line)<BR>\n!;
}
print "\n</PRE>";
&log_action ("CGI ERROR: $error") if (!$nolog and $config{'logfile
+'});
exit;
}
..and then use it to target suspected error locations, like this:
<..lines of code..>
&cgierr("fatal undef error: $@", 1);
Also, the visual debugger that comes with Activestates dev kit works well in this instance, but you can also (specuially if you are using CGI) use the debug option when you invoke the script manually and trace it through on the commandline, but that is a bit messy looking the first couple times you do it.
*G*