X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCarp.pm;h=6199f8944877901a3db80d70f979fca99ff3ba70;hb=a6ab0b5c7971198624b2f1ac7ae236adc2773b84;hp=84508b20daec5e5d6b69f9bceeed3b608a131ed7;hpb=a3775ca3239946dafd17edff355bf2a7e4e86b61;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Carp.pm b/lib/Carp.pm index 84508b2..6199f89 100644 --- a/lib/Carp.pm +++ b/lib/Carp.pm @@ -119,6 +119,7 @@ call die() or warn(), as appropriate. # text and function arguments should be formatted when printed. $CarpInternal{Carp}++; +$CarpInternal{warnings}++; $CarpLevel = 0; # How many extra package levels to skip on carp. # How many calls to skip on confess. # Reconciling these notions is hard, use @@ -155,7 +156,15 @@ sub export_fail { sub longmess { { local $@; require Carp::Heavy; } # XXX fix require to not clear $@? - goto &longmess_heavy; + # Icky backwards compatibility wrapper. :-( + my $call_pack = caller(); + if ($Internal{$call_pack} or $CarpInternal{$call_pack}) { + return longmess_heavy(@_); + } + else { + local $CarpLevel = $CarpLevel + 1; + return longmess_heavy(@_); + } } @@ -167,7 +176,10 @@ sub longmess { sub shortmess { # Short-circuit &longmess if called via multiple packages { local $@; require Carp::Heavy; } # XXX fix require to not clear $@? - goto &shortmess_heavy; + # Icky backwards compatibility wrapper. :-( + my $call_pack = caller(); + local @CARP_NOT = caller(); + shortmess_heavy(@_); }