I thought I knew how to declare version numbers for modules. But after reading the article "$VERSION Confusion" at Modern Perl Books, a Modern Perl Blog; I'm now more confused than I started. (Ignorance was indeed bliss.) Not that I have hangups about "perfect" code but I'm just really curious why such a trivial matter apparently has no definitive answer for such a mature language.
Hope the SO community can find a definitive answer to this question as there are better things for Perl hackers to do than argue about different ways to declare version numbers.
Currently latest perl version is 5.24.
use Module VERSION
If the VERSION argument is present between Module and LIST, then the
use
will call theVERSION
method in classModule
with the given version as an argument. The defaultVERSION
method, inherited from theUNIVERSAL
class, croaks if the given version is larger than the value of the variable$Module::VERSION
.
That makes for a straightforward pattern:
package MyModule;
our $VERSION = 1.23;
# ...
1;
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