summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/diagnostics.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm
index c734c852be..82fa700008 100644
--- a/lib/diagnostics.pm
+++ b/lib/diagnostics.pm
@@ -546,7 +546,14 @@ sub death_trap {
# See if we are coming from anywhere within an eval. If so we don't
# want to explain the exception because it's going to get caught.
- my $in_eval = $^S || !defined $^S;
+ my $in_eval = 0;
+ my $i = 0;
+ while (my $caller = (caller($i++))[3]) {
+ if ($caller eq '(eval)') {
+ $in_eval = 1;
+ last;
+ }
+ }
splainthis($exception) unless $in_eval;
if (caller eq $WHOAMI) { print STDERR "INTERNAL EXCEPTION: $exception"; }