develooper Front page | perl.perl5.porters | Postings from November 2005

[perl #3269] no warnings "bareword" turns off too many warnings.

Thread Next
Animator via RT
November 29, 2005 16:50
[perl #3269] no warnings "bareword" turns off too many warnings.
Message ID:
> [rickdelaney - Sat Sep 17 08:07:20 2005]:
> Does this patch look ok?

The patch might be ok but something is still broken...

Below you find two examples: one in which a warning should be produced and another one where no warning should be produced. It does the exact opposite of what I expect... even though ${^WARNING_BITS} seems to be correct... (So I'm not sure if this is an issue with this patch or with something else)

Example 1:


$^W = 1;
no warnings qw/numeric/;
my $b;
chop $b;

No -w, but $^W is 1 so it should produce the warning. (It produces one if 'no warnings' is left out.)

Example 2:

#!perl -w

$^W = 0;
no warnings qw/numeric/;
my $b;
chop $b;

-w is set but $^W is 0 so warnings are disabled. So the warning shouldn't be shown...

My best guess is that those problems happen because the no warnings is done at compile time while $^W is changed at run time...

Another thing that might not work 100% is -W and/or -X... my basic testing shows that they work as expected but I only did some basic tests...

(I tried modifying the patch but without success.)

Can you be kind enough to take (another) look at it? :)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About