From 4f527b719ae8907622f7dc49e1c381136e69bb59 Mon Sep 17 00:00:00 2001 From: Anno Siegel Date: Sun, 31 Aug 2003 22:08:19 +0000 Subject: 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 --- lib/warnings.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/warnings.pm') 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])") -- cgit v1.2.1