If you want to use Perl 5.6.0isms and make sure that perl won't attempt to run the code with an earler version, you can always require version number; (see perlfunc's require entry for more information).
The problem with the code you've listed is that it uses a pragmatic module that isn't available in versions prior to 5.6.0. If someone tries to run this code with an earlier version, perl will try to locate and evaluate warnings.pm before it tries to evaluate the version requirement, and will tell you it "can't locate warnings.pm in @INC..." then die.
If you place the version requirement in a BEGIN block it will be evaluated before any attempt to find warnings.pm and perl will print a message explaining that at least 5.006 is required and then die.
# note that versions prior to 5.6.0 require the numeric # representation of the version number and don't recognize # v5.6.0 or 5.6.0, for example. BEGIN { require 5.006_00 }
Example:
$ perl553 -e 'BEGIN{require 5.006_00}; use warnings;' Perl 5.006 required--this is only version 5.00503, stopped at -e line +1. BEGIN failed--compilation aborted at -e line 1.
Update:
require happens at run-time, after compilation, while use happens at compile-time. This is why perl tries to use the pragmatic module warnings.pm before require version number; is evaluated.
Placing the require expression in a BEGIN block is one solution, but not the best. use module counts as a BEGIN block and is evaluated at compile-time, so the best solution here is probably:
use 5.006_00;
In reply to Re: All files in dir to Storable.pm data
by converter
in thread All files in dir to Storable.pm data
by deprecated
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |