Lot's of ways to set your modules $VERSION
in perl, some even have advantages. What I don't know is why we do it? I mean the META.yml has a version... which is what cpan
uses? so why do we set it in the module? what's the point?
So you can say
use Module::Name 4.5.6;
And the code will fail if you don't have at least version 4.5.6 of Module::Name installed.
It is also helpful when you need to know what version is installed, you can just say:
perl -MScalar::Util=99999999999999
This is roughly equivalent to
#!/usr/bin/perl
use Scalar::Util 99999999999999;
It will fail (becuase Scalar::Util
is nowhere near version 99999999999999) and tell you the version number. In my case it says:
Scalar::Util version v.Inf required--this is only version 1.22 at
/Users/cowens/apps/perlbrew/perls/perl-5.12.1/lib/5.12.1/Exporter/Heavy.pm
line 120.
BEGIN failed--compilation aborted.
From perlmodlib: Guidelines for Module Creation:
To be fully compatible with the Exporter and MakeMaker modules you should store your module's version number in a non-my package variable called $VERSION.
To supplement the Answers given by others, here is the link to use MODULE VERSION
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With