summaryrefslogtreecommitdiff
path: root/lib/warnings.pm
diff options
context:
space:
mode:
authorAnno Siegel <anno4000@lublin.zrz.tu-berlin.de>2003-08-31 22:08:19 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-09-10 21:18:59 +0000
commit4f527b719ae8907622f7dc49e1c381136e69bb59 (patch)
treed814ae69be947ba0fff011ff14e130fc51910477 /lib/warnings.pm
parent788611b6a6a160290f10302fc348e5dff91edc6e (diff)
downloadperl-4f527b719ae8907622f7dc49e1c381136e69bb59.tar.gz
Re: [perl #15395] lexical warnings and inheritance
Message-Id: <200308312208.WAA25312@lublin.zrz.TU-Berlin.DE> The test has been moved into warnings.pm's test suite. Note that this patch fixed as well the behaviour of warnings::enabled regarding lexical scoping and different files; hence the expected results in a few tests in /t/lib/warnings/9enabled has been reverted. p4raw-id: //depot/perl@21167
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])")