summaryrefslogtreecommitdiff
path: root/lib/warnings.pm
diff options
context:
space:
mode:
authorPaul Marquess <paul.marquess@btinternet.com>2002-03-24 23:00:21 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-24 22:35:56 +0000
commitc3186b657097c822f3b2e667eea90ac8342b05f0 (patch)
tree94f3c9ae57ba66106820b8fd757957c97d7caf27 /lib/warnings.pm
parenteb595c73116cfa1a9cbccc69ef5c52c7317af4cd (diff)
downloadperl-c3186b657097c822f3b2e667eea90ac8342b05f0.tar.gz
fix warning + carp interaction
From: "Paul Marquess" <paul_marquess@yahoo.co.uk> Message-ID: <AIEAJICLCBDNAAOLLOKLGEKCEAAA.paul_marquess@yahoo.co.uk> p4raw-id: //depot/perl@15481
Diffstat (limited to 'lib/warnings.pm')
-rw-r--r--lib/warnings.pm22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/warnings.pm b/lib/warnings.pm
index 0b32815e25..8c4791370e 100644
--- a/lib/warnings.pm
+++ b/lib/warnings.pm
@@ -278,6 +278,12 @@ $BYTES = 12 ;
$All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ;
+sub Croaker
+{
+ delete $Carp::CarpInternal{'warnings'};
+ croak @_ ;
+}
+
sub bits {
my $mask ;
my $catmask ;
@@ -291,7 +297,7 @@ sub bits {
$mask |= $DeadBits{$word} if $fatal ;
}
else
- { croak("Unknown warnings category '$word'")}
+ { Croaker("Unknown warnings category '$word'")}
}
return $mask ;
@@ -327,19 +333,19 @@ sub __chk
# check the category supplied.
$category = shift ;
if (ref $category) {
- croak ("not an object")
+ Croaker ("not an object")
if $category !~ /^([^=]+)=/ ;
$category = $1 ;
$isobj = 1 ;
}
$offset = $Offsets{$category};
- croak("Unknown warnings category '$category'")
+ Croaker("Unknown warnings category '$category'")
unless defined $offset;
}
else {
$category = (caller(1))[0] ;
$offset = $Offsets{$category};
- croak("package '$category' not registered for warnings")
+ Croaker("package '$category' not registered for warnings")
unless defined $offset ;
}
@@ -367,7 +373,7 @@ sub __chk
sub enabled
{
- croak("Usage: warnings::enabled([category])")
+ Croaker("Usage: warnings::enabled([category])")
unless @_ == 1 || @_ == 0 ;
my ($callers_bitmask, $offset, $i) = __chk(@_) ;
@@ -380,12 +386,11 @@ sub enabled
sub warn
{
- croak("Usage: warnings::warn([category,] 'message')")
+ Croaker("Usage: warnings::warn([category,] 'message')")
unless @_ == 2 || @_ == 1 ;
my $message = pop ;
my ($callers_bitmask, $offset, $i) = __chk(@_) ;
- local $Carp::CarpLevel = $i ;
croak($message)
if vec($callers_bitmask, $offset+1, 1) ||
vec($callers_bitmask, $Offsets{'all'}+1, 1) ;
@@ -394,12 +399,11 @@ sub warn
sub warnif
{
- croak("Usage: warnings::warnif([category,] 'message')")
+ Croaker("Usage: warnings::warnif([category,] 'message')")
unless @_ == 2 || @_ == 1 ;
my $message = pop ;
my ($callers_bitmask, $offset, $i) = __chk(@_) ;
- local $Carp::CarpLevel = $i ;
return
unless defined $callers_bitmask &&