diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-07-21 20:54:39 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-07-21 20:54:39 +0100 |
commit | bf236c8ee5b1b47df84e2e196fb90a43c6abd5a2 (patch) | |
tree | 61f73df11e3219caa8dd25ff8f81422efb983932 /lib/Carp.pm | |
parent | eff7e72c3d4dda827de2e7b972c08a37cbcf607e (diff) | |
download | perl-bf236c8ee5b1b47df84e2e196fb90a43c6abd5a2.tar.gz |
In Carp, if B is loaded use it to get the name of the bad caller override.
Diffstat (limited to 'lib/Carp.pm')
-rw-r--r-- | lib/Carp.pm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Carp.pm b/lib/Carp.pm index cb86f9cdd8..31e57d3696 100644 --- a/lib/Carp.pm +++ b/lib/Carp.pm @@ -1,6 +1,6 @@ package Carp; -our $VERSION = '1.17'; +our $VERSION = '1.18'; our $MaxEvalLen = 0; our $Verbose = 0; @@ -83,7 +83,17 @@ sub caller_info { if ($call_info{has_args}) { my @args; if (@DB::args == 1 && ref $DB::args[0] eq ref \$i && $DB::args[0] == \$i) { - @args = "** Incomplete caller override detected; \@DB::args were not set **"; + local $@; + my $where = eval { + my $gv = B::svref_2object(\&CORE::GLOBAL::caller)->GV; + my $package = $gv->STASH->NAME; + my $subname = $gv->NAME; + return unless defined $package && defined $subname; + # returning CORE::GLOBAL::caller isn't useful for tracing the cause: + return if $package eq 'CORE::GLOBAL' && $subname eq 'caller'; + " in &${package}::$subname"; + } // ''; + @args = "** Incomplete caller override detected$where; \@DB::args were not set **"; } else { @args = map {Carp::format_arg($_)} @DB::args; } |