LanX has asked for the wisdom of the Perl Monks concerning the following question:
Is it also possible to use this mechanism to disable my own debug messages for a scope?
(I'm aware about the possibility to manipulate $SIG{"__WARN__"} handler, but trying not to reinvent the wheel².)
use strict; use warnings; my $x; { no warnings; # no warnings 'uninitialized'; print "$x"; warn "inside"; } print "$x"; warn "outside";
inside at d:/Users/lanx/pm/no_warn.pl line 9. Use of uninitialized value $x in string at d:/Users/lanx/pm/no_warn.pl + line 11. outside at d:/Users/lanx/pm/no_warn.pl line 12.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
²) and overusing Pad::Walker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using 'no warnings' to disable own debug warn(ing)s?
by LanX (Saint) on Jun 22, 2018 at 18:05 UTC | |
by haukex (Archbishop) on Jun 22, 2018 at 19:06 UTC |