Nate Glenn
Nate Glenn

Reputation: 6744

Check module compatibility with different Perl versions

Is there a command line switch or any other easy way that I can check the compatibility of my module with different versions of perl? I understand that if I put use 5.6.1; at the top of a script, the script will have any features later than 5.6.1 disabled. But if I have a module which uses several other modules and so on, I need a quicker way to check what minimum version of Perl to require in my Makefile.PL or Build.PL.

Upvotes: 2

Views: 1662

Answers (3)

Borodin
Borodin

Reputation: 126722

use v5.6.1 and similar will primarily raise a compile-time error if the version of Perl in use is older than that specified. In addition, the corresponding feature bundle is enabled, and if the version is v5.11 or higher, the strict pragma is enabled as well.

use v5.6.1 will not make Perl v5.8 behave like v5.6.1, and there is no way of achieving this. Even in later versions it is only features that can be controlled using the feature pragma that are adjusted to a given version.

To test your module you will have to install each different version of Perl and test it separately

Upvotes: 5

mob
mob

Reputation: 118595

Run your module against Perl::MinimumVersion.

Upvotes: 5

tauli
tauli

Reputation: 1420

You can just install different versions of perl and test against those. I install them by hand in different locations but if you want to automate that, use perlbrew.

There might be scripts or strategies that try to find the minimum version of perl needed, but everything i tried several years ago to obtain and aggregate the minimum perl version i found clunky and unreliable. Which of course doesn't mean, that it doesn't exist or can't be done, but just that i couldn't find it.

Upvotes: 2

Related Questions