just found an "if pragma" which could be used for backwards compatibility!Ah, but if.pm has backwards compatability issues itself - it first appeared in 5.6.2† Here's what I use if I want to use warnings, but still want the code to be able to run in 5.005 (without warnings enabled of course):
Note that if you want to be able to do no warnings, you have to create a dummy sub warnings::unimport as well.BEGIN { $INC{"warnings.pm"} = 1 if $] < 5.006; } use strict; use warnings;
†I've no reason to assume if.pm cannot be installed in 5.005. I just don't want another module dependency for what I can do in a single statement myself.
In reply to Re^5: Howto "use" backward compability packages of new "feature"s
by JavaFan
in thread Howto "use" backward compability packages of new "feature"s
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |