|We don't bite newbies here... much|
Supressing warningsby Anonymous Monk
|on Jul 22, 2010 at 13:50 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
Hi, I came across a few things with regard to the suppression of warnings that surprised me, so I thought I look for some enlightenment here...
I am using Perl 5.12 and Net::SNMP 6.0.0.
The following script produces 26 deprecation warnings:
Because the warnings come from another file you cannot simply disable them with "no warnings 'deprecated'", so if you want to get rid of them you can of course disable them globally with -X:
Now I thought that you could achieve the same effect with $^W, so I had expected that this would also get rid of the warnings:
but surprisingly it doesn't - this emits warnings. Why is that?
Also I had expected that if you would run "perl script2" (the script with the -X in the shebang-line) you would see the warnings again (as there is now no -X on the commandline) but surprisingly you don't. It seems the -X of the shebang-line takes effect even though you explicitly invoke perl on the command line. Is that so?
Finally I would be interested if there is a way to globally disable specifically the deprecation warnings only.