X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fdiagnostics.pm;h=c68fa3f79f8e9d361942686e6014d1d7622d520c;hb=1119cb729a6f7864ad220ffc03f5b5ff9684a8ae;hp=4ef9a2f64dae977aad0b7769e25b4d1951e5bb4f;hpb=95e8664e86da93255f26600f44bbbd70bf5b5b0e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm index 4ef9a2f..c68fa3f 100755 --- a/lib/diagnostics.pm +++ b/lib/diagnostics.pm @@ -168,10 +168,10 @@ Tom Christiansen >, 25 June 1995. =cut use strict; -use 5.6.0; +use 5.006; use Carp; -our $VERSION = 1.0; +our $VERSION = 1.1; our $DEBUG; our $VERBOSE; our $PRETTY; @@ -411,7 +411,7 @@ sub import { shift; $^W = 1; # yup, clobbered the global variable; # tough, if you want diags, you want diags. - return if $SIG{__WARN__} eq \&warn_trap; + return if defined $SIG{__WARN__} && ($SIG{__WARN__} eq \&warn_trap); for (@_) { @@ -476,11 +476,18 @@ sub death_trap { if (caller eq $WHOAMI) { print STDERR "INTERNAL EXCEPTION: $exception"; } &$olddie if defined $olddie and $olddie and $olddie ne \&death_trap; + return if $in_eval; + # We don't want to unset these if we're coming from an eval because - # then we've turned off diagnostics. (Actually what does this next - # line do? -PSeibel) - $SIG{__DIE__} = $SIG{__WARN__} = '' unless $in_eval; + # then we've turned off diagnostics. + + # Switch off our die/warn handlers so we don't wind up in our own + # traps. + $SIG{__DIE__} = $SIG{__WARN__} = ''; + + # Have carp skip over death_trap() when showing the stack trace. local($Carp::CarpLevel) = 1; + confess "Uncaught exception from user code:\n\t$exception"; # up we go; where we stop, nobody knows, but i think we die now # but i'm deeply afraid of the &$olddie guy reraising and us getting