summaryrefslogtreecommitdiff
path: root/warnings.pl
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 /warnings.pl
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 'warnings.pl')
-rw-r--r--warnings.pl22
1 files changed, 13 insertions, 9 deletions
diff --git a/warnings.pl b/warnings.pl
index 9a13cf01c4..9149f69194 100644
--- a/warnings.pl
+++ b/warnings.pl
@@ -522,6 +522,12 @@ KEYWORDS
$All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ;
+sub Croaker
+{
+ delete $Carp::CarpInternal{'warnings'};
+ croak @_ ;
+}
+
sub bits {
my $mask ;
my $catmask ;
@@ -535,7 +541,7 @@ sub bits {
$mask |= $DeadBits{$word} if $fatal ;
}
else
- { croak("Unknown warnings category '$word'")}
+ { Croaker("Unknown warnings category '$word'")}
}
return $mask ;
@@ -571,19 +577,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 ;
}
@@ -611,7 +617,7 @@ sub __chk
sub enabled
{
- croak("Usage: warnings::enabled([category])")
+ Croaker("Usage: warnings::enabled([category])")
unless @_ == 1 || @_ == 0 ;
my ($callers_bitmask, $offset, $i) = __chk(@_) ;
@@ -624,12 +630,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) ;
@@ -638,12 +643,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 &&