diff options
author | Hauke D <haukex@zero-g.net> | 2014-01-13 00:50:51 +0100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2014-01-22 16:32:14 +1100 |
commit | c91312d5e67fd262ccd6f36ff40ddbca6896d004 (patch) | |
tree | 95057cfca0a55d90b2a3af13205b44701698c773 /lib/warnings.pm | |
parent | e214621be67f417c619e2038fcb4742892fde1b1 (diff) | |
download | perl-c91312d5e67fd262ccd6f36ff40ddbca6896d004.tar.gz |
assume "all" in "use warnings 'FATAL';" and related
Until now, the behavior of the statements
use warnings "FATAL";
use warnings "NONFATAL";
no warnings "FATAL";
was unspecified and inconsistent. This change causes them to be handled
with an implied "all" at the end of the import list.
Tony Cook: fix AUTHORS formatting
Diffstat (limited to 'lib/warnings.pm')
-rw-r--r-- | lib/warnings.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/warnings.pm b/lib/warnings.pm index c42a81996e..738a832bb6 100644 --- a/lib/warnings.pm +++ b/lib/warnings.pm @@ -424,6 +424,9 @@ sub import $mask |= $Bits{'all'} ; $mask |= $DeadBits{'all'} if vec($mask, $Offsets{'all'}+1, 1); } + + # append 'all' when implied (after a lone "FATAL" or "NONFATAL") + push @_, 'all' if @_==1 && ( $_[0] eq 'FATAL' || $_[0] eq 'NONFATAL' ); # Empty @_ is equivalent to @_ = 'all' ; ${^WARNING_BITS} = @_ ? _bits($mask, @_) : $mask | $Bits{all} ; @@ -441,7 +444,8 @@ sub unimport $mask |= $DeadBits{'all'} if vec($mask, $Offsets{'all'}+1, 1); } - push @_, 'all' unless @_; + # append 'all' when implied (empty import list or after a lone "FATAL") + push @_, 'all' if !@_ || @_==1 && $_[0] eq 'FATAL'; foreach my $word ( @_ ) { if ($word eq 'FATAL') { |