This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix by Rick Delaney for [perl #3269] no warnings "bareword" turns off
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 27 Sep 2005 14:25:53 +0000 (14:25 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 27 Sep 2005 14:25:53 +0000 (14:25 +0000)
too many warnings.

p4raw-id: //depot/perl@25619

mg.c
t/io/binmode.t
t/lib/warnings/2use

diff --git a/mg.c b/mg.c
index d3a001a..46b2d75 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -785,11 +785,16 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
        if (*(mg->mg_ptr+1) == '\0')
            sv_setiv(sv, (IV)((PL_dowarn & G_WARN_ON) ? TRUE : FALSE));
        else if (strEQ(mg->mg_ptr+1, "ARNING_BITS")) {
-           if (PL_compiling.cop_warnings == pWARN_NONE ||
-               PL_compiling.cop_warnings == pWARN_STD)
-           {
+           if (PL_compiling.cop_warnings == pWARN_NONE) {
                sv_setpvn(sv, WARN_NONEstring, WARNsize) ;
-            }
+           }
+           else if (PL_compiling.cop_warnings == pWARN_STD) {
+               sv_setpvn(
+                   sv, 
+                   (PL_dowarn & G_WARN_ON) ? WARN_ALLstring : WARN_NONEstring,
+                   WARNsize
+               );
+           }
             else if (PL_compiling.cop_warnings == pWARN_ALL) {
                /* Get the bit mask for $warnings::Bits{all}, because
                 * it could have been extended by warnings::register */
index be198ae..41eff4a 100644 (file)
@@ -35,7 +35,7 @@ SKIP: {
     skip "minitest", 1 if $ENV{PERL_CORE_MINITEST};
     skip "no EBADF", 1 if (!exists &Errno::EBADF);
 
-    no warnings 'io';
+    no warnings 'io', 'once';
     $! = 0;
     binmode(B);
     ok($! == &Errno::EBADF);
index 7810287..eef0f3f 100644 (file)
@@ -72,6 +72,12 @@ my $a =+ 1 ;
 EXPECT
 Reversed += operator at - line 3.
 ########
+-w
+no warnings 'reserved' ;
+foo.bar;
+EXPECT
+Useless use of concatenation (.) or string in void context at - line 3.
+########
 
 --FILE-- abc
 my $a =+ 1 ;