This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Extensive documentation patch redux
[perl5.git] / lib / Carp.pm
index 84508b2..6199f89 100644 (file)
@@ -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(@_);
 }