diff options
author | Dan Book <grinnz@grinnz.com> | 2020-04-01 13:04:35 -0400 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-04-01 14:06:34 -0600 |
commit | 45f87e658628cd0ee4595d39ffbf774a44c72a1f (patch) | |
tree | c9139a9d7ca02e268e28cafbacc10d12efcfb36a /lib/warnings.pm | |
parent | 5de22a40933c620b62e1f431457593777b99793d (diff) | |
download | perl-45f87e658628cd0ee4595d39ffbf774a44c72a1f.tar.gz |
warnings.pm - Clarify scoping of $^W examples
Diffstat (limited to 'lib/warnings.pm')
-rw-r--r-- | lib/warnings.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/warnings.pm b/lib/warnings.pm index d434dcd36c..a70c25f125 100644 --- a/lib/warnings.pm +++ b/lib/warnings.pm @@ -5,7 +5,7 @@ package warnings; -our $VERSION = "1.46"; +our $VERSION = "1.47"; # Verify that we're called correctly so that warnings will work. # Can't use Carp, since Carp uses us! @@ -689,6 +689,10 @@ disable compile-time warnings you need to rewrite the code like this: my $b; chop $b; } +And note that unlike the first example, this will permanently set C<$^W> +since it cannot both run during compile-time and be localized to a +run-time block. + The other big problem with C<$^W> is the way you can inadvertently change the warning setting in unexpected places in your code. For example, when the code below is run (without the B<-w> flag), the second call |