summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-09-13 23:46:46 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-14 22:29:45 -0700
commit7fc874e826a059bd024f1cbd568e1021c5731f35 (patch)
tree87c39161aa48a5e51e147ab2d5d8aabbd6abf775 /dist
parentf07626add3eda6dfda7c5f6fe05cbe1c9293ccd2 (diff)
downloadperl-7fc874e826a059bd024f1cbd568e1021c5731f35.tar.gz
Stop lexical warnings from turning off deprecations
Some warnings, such as deprecation warnings, are on by default: $ perl5.16.0 -e '$*' $* is no longer supported at -e line 1. But turning *on* other warnings will turn them off: $ perl5.16.0 -e 'use warnings "void"; $*' Useless use of a variable in void context at -e line 1. Either all warnings in any given scope are controlled by lexical hints, or none of them are. When a single warnings category is turned on or off, if the warn- ings were controlled by $^W, then all warnings are first turned on lexically if $^W is 1 and all warnings are turned off lexically if $^W is 0. That has the unfortunate affect of turning off warnings when it was only requested that warnings be turned on. These categories contain default warnings: ambiguous debugging deprecated inplace internal io malloc utf8 redefine syntax glob inplace overflow precedence prototype threads misc Most also contain regular warnings, but these contain *only* default warnings: debugging deprecated glob inplace malloc So we can treat $^W==0 as equivalent to qw(debugging deprecated glob inplace malloc) when enabling lexical warnings. While this means that some default warnings will still be turned off by ‘use warnings "void"’, it won’t be as many as before. So at least this is a step in the right direction. (The real solution, of course, is to allow each warning to be turned off or on on its own.)
Diffstat (limited to 'dist')
-rw-r--r--dist/IO/t/IO.t1
1 files changed, 1 insertions, 0 deletions
diff --git a/dist/IO/t/IO.t b/dist/IO/t/IO.t
index 382e282a07..2551b2468d 100644
--- a/dist/IO/t/IO.t
+++ b/dist/IO/t/IO.t
@@ -49,6 +49,7 @@ local $SIG{__WARN__} = sub { $warn = "@_" } ;
{
local $^W = 0;
+ no if $^V >= 5.17.4, warnings => "deprecated";
IO->import();
is( $warn, '', "... import default, should not warn");
$warn = '' ;