CGI-HTMLError
view release on metacpan or search on metacpan
HTMLError.pm view on Meta::CPAN
# we try to do this by examining the stack trace for (eval) frames
#
# In a case of a fatal error inside an eval, this code gets
# called twice: the first time with the (eval) frame, the
# second time without.
#
my $i;
my ($filename_from_stack,$number_from_stack);
while (1) {
my @caller = caller($i++);
if (defined $caller[3]) {
$filename_from_stack ||= $caller[1];
$number_from_stack ||= $caller[2];
return if $caller[3] eq '(eval)';
}
else {
last;
}
}
HTMLError.pm view on Meta::CPAN
}
#
# show stacktrace if a tracelevel is specified.
#
if ($CONF{trace}) {
print '<hr><em>Stacktrace:</em><pre><code>';
my $i;
while (1) {
my ($pack,$file,$number,$sub) = caller($i) or last;
printf "%02d| \&$sub called at $file line $number\n",$i++;
}
print '</code></pre>';
}
#
# end with a version identifier.
#
print "<hr><div align=right><em>CGI::HTMLError $VERSION</em></div></body></html>";
HTMLError.pm view on Meta::CPAN
=head2 EXPORT
This module does not export anything in the usual sense: it installs a C<$SIG{__DIE__}> handler instead. See also L</GOTCHAS>
=head1 GOTCHAS
=over 4
=item Finding the right filename and line number
By default, C<CGI::HTMLError> expects the filename and line number to be in the error message handed to the handler (normally this is $@). This gives application writers the chance to point to another file as the actual cause of the problem (for inst...
If no filename can be found, only the error message and the optional stacktrace will be shown.
=item Security
B<Do not use this in a production environment!> This code is strictly for debugging. Read the L<SECURITY ALERT> secion.
=item Other DIE handlers
The $SIG{__DIE__} handler installed by this program will attempt to call earlier installed $SIG{__DIE__} handlers after its own. Some other modules (i.e. C<CGI::Carp>) do not do this, if so try using C<CGI::HTMLError> after the other module has insta...
( run in 0.359 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )