diff options
author | Robin Houston <robin@cpan.org> | 2001-07-05 19:33:21 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-07-06 01:14:41 +0000 |
commit | 810aef70ac1dc6f0d998a193ba184e80bc0cc202 (patch) | |
tree | a853e9892f057423fb7b096c81f4f8472939af9b /ext | |
parent | a27978d3b51a1694fbb3bf9d13a41f0518386f5c (diff) | |
download | perl-810aef70ac1dc6f0d998a193ba184e80bc0cc202.tar.gz |
Make warnings handling more robust
Message-ID: <20010705183321.A27345@robin.kitsite.com>
p4raw-id: //depot/perl@11167
Diffstat (limited to 'ext')
-rw-r--r-- | ext/B/B/Deparse.pm | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 2e0921f381..08f073e89d 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -496,9 +496,15 @@ sub new { return $self; } -sub WARN_MASK () { - # Mask out the bits that C<use vars> uses - $warnings::Bits{all} | $warnings::DeadBits{all}; +{ + # Mask out the bits that L<warnings::register> uses + my $WARN_MASK; + BEGIN { + $WARN_MASK = $warnings::Bits{all} | $warnings::DeadBits{all}; + } + sub WARN_MASK () { + return $WARN_MASK; + } } # Initialise the contextual information, either from @@ -626,7 +632,7 @@ sub ambient_pragmas { elsif ($name eq 'warnings') { if ($val eq 'none') { - $warning_bits = "\0"x12; + $warning_bits = $warnings::NONE; next(); } @@ -638,7 +644,7 @@ sub ambient_pragmas { @names = split/\s+/, $val; } - $warning_bits = "\0"x12 if !defined ($warning_bits); + $warning_bits = $warnings::NONE if !defined ($warning_bits); $warning_bits |= warnings::bits(@names); } @@ -1270,10 +1276,10 @@ sub pp_nextstate { my $warnings = $op->warnings; my $warning_bits; if ($warnings->isa("B::SPECIAL") && $$warnings == 4) { - $warning_bits = $warnings::Bits{"all"}; + $warning_bits = $warnings::Bits{"all"} & WARN_MASK; } elsif ($warnings->isa("B::SPECIAL") && $$warnings == 5) { - $warning_bits = "\0"x12; + $warning_bits = $warnings::NONE; } elsif ($warnings->isa("B::SPECIAL")) { $warning_bits = undef; |