X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCarp.pm;h=6bac36446a7d61e633ad6da272f95d7e35be4b51;hb=3937c24e3f4ed26beafd7a2fbe3a20466bfc2b2d;hp=6397d1b999198c29ec8f95c26233fc711b481400;hpb=7b8d334a971230040a212bc5038097b3f600a094;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Carp.pm b/lib/Carp.pm index 6397d1b..6bac364 100644 --- a/lib/Carp.pm +++ b/lib/Carp.pm @@ -60,6 +60,7 @@ $CarpLevel = 0; # How many extra package levels to skip on carp. $MaxEvalLen = 0; # How much eval '...text...' to show. 0 = all. $MaxArgLen = 64; # How much of each argument to print. 0 = all. $MaxArgNums = 8; # How many arguments to print. 0 = all. +$Verbose = 0; # If true then make shortmess call longmess instead require Exporter; @ISA = ('Exporter'); @@ -75,11 +76,7 @@ require Exporter; sub export_fail { shift; - if ($_[0] eq 'verbose') { - local $^W = 0; # avoid "sub-routine redefined..." warning - *shortmess = \&longmess; # set shortmess() as an alias to longmess() - shift; # remove 'verbose' from the args to keep Exporter happy - } + $Verbose = shift if $_[0] eq 'verbose'; return @_; } @@ -188,10 +185,11 @@ sub longmess { # shortmess() is called by carp() and croak() to skip all the way up to # the top-level caller's package and report the error from there. confess() # and cluck() generate a full stack trace so they call longmess() to -# generate that. In verbose mode shortmess() is aliased to longmess() so +# generate that. In verbose mode shortmess() calls longmess() so # you always get a stack trace sub shortmess { # Short-circuit &longmess if called via multiple packages + goto &longmess if $Verbose; my $error = join '', @_; my ($prevpack) = caller(1); my $extra = $CarpLevel;