From ec087511b22a0ebd4a71b36d9f3bd3241226819e Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sun, 29 Jul 2012 13:25:50 -0700 Subject: Revert "Use $^S instead of caller in splain" This reverts commit 019070c31184a4deb57cb85f7e597a789c6c5b54. I misunderstood $^S, and thought I could simplify the code. Contrary to what perlvar says, $^S is undefined not only during compilation of an eval or module, but also during compilation of the main program. --- lib/diagnostics.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') 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"; } -- cgit v1.2.1