summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Pritikin <Joshua.Pritikin@NewYork2.dmg.deuba.com>1998-04-22 10:48:07 +1200
committerTim Bunce <Tim.Bunce@ig.co.uk>1998-05-02 05:50:46 +1200
commit3e81555603d0a4d4a7c16cf3c12d68397af2c9f8 (patch)
treece0cc86407043de4a134965543bcac92fda0b480
parentc5567f7d72158f9105206b99b68bc79b129f51ec (diff)
downloadperl-3e81555603d0a4d4a7c16cf3c12d68397af2c9f8.tar.gz
Runtime Carp verbosity without aliasing
Subject: Carp verbosity Speaking of Carp, how about this small change? p5p-msgid: H00000e50003936c@MHS
-rw-r--r--lib/Carp.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Carp.pm b/lib/Carp.pm
index 6397d1b999..fc8a3c6b5e 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;
require Exporter;
@ISA = ('Exporter');
@@ -76,8 +77,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()
+ ++$Verbose;
shift; # remove 'verbose' from the args to keep Exporter happy
}
return @_;
@@ -192,6 +192,10 @@ sub longmess {
# you always get a stack trace
sub shortmess { # Short-circuit &longmess if called via multiple packages
+ if ($Verbose) {
+ local $CarpLevel = $CarpLevel + 1;
+ return &longmess;
+ }
my $error = join '', @_;
my ($prevpack) = caller(1);
my $extra = $CarpLevel;