Harmon S. Nine <hnine@netarx.com>
Harri Pasanen <harri.pasanen@trema.com>
Harry Edmon <harry@atmos.washington.edu>
+Hauke D <haukex@zero-g.net>
Helmut Jarausch <jarausch@numa1.igpm.rwth-aachen.de>
Henrik Tougaard <ht.000@foa.dk>
Herbert Breunung <lichtkind@cpan.org>
$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} ;
$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') {
use warnings FATAL => 'all', NONFATAL => 'syntax';
+As of Perl 5.20, instead of C<< use warnings FATAL => 'all'; >> you can
+use:
+
+ use v5.20; # Perl 5.20 or greater is required for the following
+ use warnings 'FATAL'; # short form of "use warnings FATAL => 'all';"
+
+If you want your program to be compatible with versions of Perl before
+5.20, you must use C<< use warnings FATAL => 'all'; >> instead. (In
+previous versions of Perl, the behavior of the statements
+C<< use warnings 'FATAL'; >>, C<< use warnings 'NONFATAL'; >> and
+C<< no warnings 'FATAL'; >> was unspecified; they did not behave as if
+they included the C<< => 'all' >> portion. As of 5.20, they do.)
+
B<NOTE:> Users of FATAL warnings, especially
those using C<< FATAL => 'all' >>
should be fully aware that they are risking future portability of their
$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} ;
$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') {
EXPECT
Unsuccessful open on filename containing newline at - line 5.
close() on unopened filehandle fred at - line 6.
+########
+
+# 'use warnings' test as the basis for the following tests
+use warnings ;
+my $a = oct "7777777777777777777777777777777777778" ;
+my $b =+ 1 ;
+my $c ; chop $c ;
+print STDERR "The End.\n" ;
+EXPECT
+Reversed += operator at - line 5.
+Integer overflow in octal number at - line 4.
+Illegal octal digit '8' ignored at - line 4.
+Octal number > 037777777777 non-portable at - line 4.
+Use of uninitialized value $c in scalar chop at - line 6.
+The End.
+########
+
+# 'use warnings NONFATAL=>"all"' should be the same as 'use warnings'
+use warnings NONFATAL=>"all" ;
+my $a = oct "7777777777777777777777777777777777778" ;
+my $b =+ 1 ;
+my $c ; chop $c ;
+print STDERR "The End.\n" ;
+EXPECT
+Reversed += operator at - line 5.
+Integer overflow in octal number at - line 4.
+Illegal octal digit '8' ignored at - line 4.
+Octal number > 037777777777 non-portable at - line 4.
+Use of uninitialized value $c in scalar chop at - line 6.
+The End.
+########
+
+# 'use warnings "NONFATAL"' should be the same as 'use warnings' [perl #120977]
+use warnings "NONFATAL" ;
+my $a = oct "7777777777777777777777777777777777778" ;
+my $b =+ 1 ;
+my $c ; chop $c ;
+print STDERR "The End.\n" ;
+EXPECT
+Reversed += operator at - line 5.
+Integer overflow in octal number at - line 4.
+Illegal octal digit '8' ignored at - line 4.
+Octal number > 037777777777 non-portable at - line 4.
+Use of uninitialized value $c in scalar chop at - line 6.
+The End.
+########
+
+# 'use warnings "FATAL"' should be the same as 'use warnings FATAL=>"all"' [perl #120977]
+use warnings "FATAL" ;
+{
+ no warnings ;
+ my $a =+ 1 ;
+}
+my $a =+ 1 ;
+print STDERR "The End.\n" ;
+EXPECT
+Reversed += operator at - line 8.
+########
+
+# 'use warnings "FATAL"' should be the same as 'use warnings FATAL=>"all"' [perl #120977]
+use warnings "FATAL" ;
+{
+ no warnings ;
+ my $a = oct "7777777777777777777777777777777777778" ;
+}
+my $a = oct "7777777777777777777777777777777777778" ;
+print STDERR "The End.\n" ;
+EXPECT
+Integer overflow in octal number at - line 8.
+########
+
+# 'no warnings FATAL=>"all"' should be the same as 'no warnings'
+use warnings ;
+{
+ no warnings FATAL=>"all" ;
+ my $a = oct "7777777777777777777777777777777777778" ;
+ my $b =+ 1 ;
+ my $c ; chop $c ;
+}
+my $a =+ 1 ;
+print STDERR "The End.\n" ;
+EXPECT
+Reversed += operator at - line 10.
+The End.
+########
+
+# 'no warnings "FATAL"' should be the same as 'no warnings' [perl #120977]
+use warnings ;
+{
+ no warnings "FATAL" ;
+ my $a = oct "7777777777777777777777777777777777778" ;
+ my $b =+ 1 ;
+ my $c ; chop $c ;
+}
+my $a =+ 1 ;
+print STDERR "The End.\n" ;
+EXPECT
+Reversed += operator at - line 10.
+The End.