Modules are cool especially when they come with versioning. You can define minimum module version to prevent leak of methods you want to use. But with every light side there comes a dark side which means Perl's TIMTOWTDI.
After nearly seven years as a Perl developer I saw and wrote version declarations in many ways. Some are easily to point as bad, some not. As no one can know a language completely I would like to ask you guys whats the pros and cons of the following software versioning in Perl is.
Please don't hesitate to comment more ways of version definition if you find one leaking ;)
Please respect:
- weird require/use of module that may cause trouble detecting module's version (compile vs runtime)
- PAUSE/CPAN parsing (and other common services)
- readability for end users
- maintainability for developers
What are the pros and cons about declaring package version methods in Perl?
Method 1
package PackageName;
BEGIN {
use version 0.77; our $VERSION = version->new('v0.0_1');
}
Method 2
package PackageName;
BEGIN {
our $VERSION = 0.000_01;
}
Method 3
package PackageName;
BEGIN {
our $VERSION = 0.0.1;
}
Method 4
package PackageName;
use version 0.77; our $VERSION = version->new('v0.0_1');
Method 5
package PackageName;
our $VERSION = 0.000_01;
Method 6
package PackageName;
our $VERSION = 0.0.1;