perldist-zilla

How to have Dist::zilla specifying min Perl version in YAML?


I’d like to specify minimum required Perl version in the yaml file. While I did put perl among requirements in my dist.ini, I think I need some module to have it written to the yaml file at build time.

My dist.ini is https://metacpan.org/source/PROCH/Proch-N50-0.032/dist.ini

The kwalitee issue is described here https://cpants.cpanauthors.org/kwalitee/meta_yml_declares_perl_version

Thanks for your help.


Solution

  • The convention for specifying a minimum perl version for a distribution is a runtime-requires prerequisite on 'perl'. (Note: I say convention, because there is no 'perl' module, and you can't actually cause a CPAN client to install a newer Perl if it's too old.) The appropriate plugins will read this and set other things based on it, like "use 5.XXX" in the generated Makefile.PL. Instead of passing prereqs as options to [@Basic], you need to use a plugin which can set prereqs, like [Prereqs]. Here is the documentation. You would want to use it like:

    [Prereqs / RuntimeRequires]
    perl = 5.018
    JSON = 0
    

    You can use the Prereqs plugin additional times for different Phase+Relationship combinations, but they each must have a unique name (the part after the /).