good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
but surprisingly it doesn't - this emits warnings. Why is that? My guess is that this has the same scope problems that no warnings 'deprecated' has. It seems the -X of the shebang-line takes effect even though you explicitly invoke perl on the command line. Is that so? From DESCRIPTION in perlrun: The #! line is always examined for switches as the line is being parsed. Finally I would be interested if there is a way to globally disable specifically the deprecation warnings only. I'm hoping someone can offer up a more elegant solution, as the following seems a little fragile/hackish. In order to filter out deprecation warnings, I've put in a BEGIN block with a second internal block with a localized WARN handler. Since perl compiles each module at most one time, this catches the emitted warnings on the first compile. The regular expression then filters out any newline-delimited portion of the emitted warnings that contain the word deprecated. Note that swapping from a require to a use will make the following code fail to catch the warnings, at least on my machine.
In reply to Re: Supressing warnings
by kennethk
|
|