On Tue, Jul 12, 2005 at 08:54:18PM -0700, Michael G Schwern via RT wrote:
> > [EMAIL PROTECTED] - Fri May 19 04:23:23 2000]:
> > 
> >     $ perl -wle 'foo.bar'
> >     Unquoted string "foo" may clash with future reserved word at -e
> > line 1.
> >     Unquoted string "bar" may clash with future reserved word at -e
> > line 1.
> >     Useless use of concatenation (.) in void context at -e line 1.
> >     $ perl -wle 'no warnings "bareword"; foo.bar'
> >     $
> 
> It seems that 'no warnings "foo"' without a preceding "use warnings"
> turns off all warnings even if -w is given!

This patch breaks test 37 of ext/B/t/deparse.t because this warning:

 # [Using a hash as a reference is deprecated at lib/B/Deparse.pm line 3151.

is no longer suppressed by C<no warnings 'uninitialized'>.

-- 
Rick Delaney
[EMAIL PROTECTED]


diff -ruN perl-current/mg.c perl-current-dev/mg.c
--- perl-current/mg.c   2005-07-07 11:16:35.000000000 -0400
+++ perl-current-dev/mg.c       2005-07-13 03:37:46.973571403 -0400
@@ -781,11 +781,16 @@
        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 */
diff -ruN perl-current/t/lib/warnings/2use perl-current-dev/t/lib/warnings/2use
--- perl-current/t/lib/warnings/2use    2004-04-23 17:05:07.000000000 -0400
+++ perl-current-dev/t/lib/warnings/2use        2005-07-13 03:27:32.832203077 
-0400
@@ -72,6 +72,12 @@
 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 ;

Reply via email to