summaryrefslogtreecommitdiff
path: root/t/pragma/warn
diff options
context:
space:
mode:
authorPaul Marquess <paul.marquess@btinternet.com>2001-03-25 22:59:15 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-28 14:42:14 +0000
commit7272584d0d275e06fe4442e1b6aecb95109596e4 (patch)
tree6556284ba80d8cc4b7b6d35a8ebc5bca3001702b /t/pragma/warn
parent3bb2c41528eaee159711f1f3c8caee43068ec4f6 (diff)
downloadperl-7272584d0d275e06fe4442e1b6aecb95109596e4.tar.gz
RE: 5.6.0 BUG: Lexical warnings aren't lexical
Message-ID: <000701c0b56e$73944220$07bdfea9@bfs.phone.com> A variable will be checked for the "use once" warnings if: 1. It is in the scope of a use warnings 'once' 2. It isn't in the scope of the warnings pragma at all AND $^W is set. Otherwise it won't be checked at all. Part 1 is what is in perl >= 5.6.0, Part 2 is what I'm fixing. The enclosed patch partially fixes this issue. What I didn't get to work was the case where the "used once" warning is enabled in any file other than the main file. p4raw-id: //depot/perl@9401
Diffstat (limited to 't/pragma/warn')
-rw-r--r--t/pragma/warn/perl15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/pragma/warn/perl b/t/pragma/warn/perl
index 7070dd447c..512ee7fb65 100644
--- a/t/pragma/warn/perl
+++ b/t/pragma/warn/perl
@@ -54,4 +54,19 @@ Name "main::x" used only once: possible typo at - line 4.
use warnings 'once' ;
$x = 3 ;
EXPECT
+########
+# perl.c
+{ use warnings 'once' ; $x = 3 ; }
+$y = 3 ;
+EXPECT
+Name "main::x" used only once: possible typo at - line 3.
+########
+
+# perl.c
+$z = 3 ;
+BEGIN { $^W = 1 }
+{ no warnings 'once' ; $x = 3 ; }
+$y = 3 ;
+EXPECT
+Name "main::y" used only once: possible typo at - line 6.