This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use $^S instead of caller in splain
authorFather Chrysostomos <sprout@cpan.org>
Sun, 29 Jul 2012 07:03:45 +0000 (00:03 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 29 Jul 2012 07:14:08 +0000 (00:14 -0700)
lib/diagnostics.pm

index 82fa700..c734c85 100644 (file)
@@ -546,14 +546,7 @@ 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 = 0;
-    my $i = 0;
-    while (my $caller = (caller($i++))[3]) {
-      if ($caller eq '(eval)') {
-       $in_eval = 1;
-       last;
-      }
-    }
+    my $in_eval = $^S || !defined $^S;
 
     splainthis($exception) unless $in_eval;
     if (caller eq $WHOAMI) { print STDERR "INTERNAL EXCEPTION: $exception"; }