summaryrefslogtreecommitdiff
path: root/lib/warnings.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/warnings.pm')
-rw-r--r--lib/warnings.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/warnings.pm b/lib/warnings.pm
index edbe1a7c74..9e9b3b55ca 100644
--- a/lib/warnings.pm
+++ b/lib/warnings.pm
@@ -439,17 +439,18 @@ sub __chk
$i -= 2 ;
}
else {
- for ($i = 2 ; $pkg = (caller($i))[0] ; ++ $i) {
- last if $pkg ne $this_pkg ;
- }
- $i = 2
- if !$pkg || $pkg eq $this_pkg ;
+ $i = _error_loc(); # see where Carp will allocate the error
}
my $callers_bitmask = (caller($i))[9] ;
return ($callers_bitmask, $offset, $i) ;
}
+sub _error_loc {
+ require Carp::Heavy;
+ goto &Carp::short_error_loc; # don't introduce another stack frame
+}
+
sub enabled
{
Croaker("Usage: warnings::enabled([category])")