BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
I would like to suppress some warnings that I know will be generated in user supplied callback code.
Ie. I thought that the no warnings statement at point A in the code below would avoid the need to do it (commented out) in the callback code, but it doesn't.
Is there some way to do this? $^H manipulations or some such?
#! perl -slw use strict; sub test (&) { my $code = shift; { no warnings 'uninitialized'; ## A $code->( undef ); } } test { # no warnings 'uninitialized'; print "@_" };
I can suppress all warnings using $^W, but I'd rather just stop the ones I know will occur and leave the rest as diagnostics for the callers code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Imposing no warnings xxx upon callback code?
by ikegami (Patriarch) on Dec 22, 2006 at 16:14 UTC | |
by BrowserUk (Patriarch) on Dec 22, 2006 at 16:38 UTC | |
|
Re: Imposing no warnings xxx upon callback code?
by SFLEX (Chaplain) on Dec 22, 2006 at 16:37 UTC | |
by ikegami (Patriarch) on Dec 22, 2006 at 19:32 UTC | |
by SFLEX (Chaplain) on Dec 22, 2006 at 19:45 UTC |