Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am using cpanfile with my app to try to make it easier to install for non-perl users.

I added a line in cpanfile specifying the minimum perl version, but I was expecting it to bail if the requirement wasn't met.

Instead, it only prints a line after it tries to install everything, saying the perl version isn't in the specified range.

I also added the requires line inside an

on 'configure' => sub { }
, but it behaves the same.

Is there a way to make it bail on the perl version, before it wastes time trying to install a bunch of modules?

Replies are listed 'Best First'.
Re: Requring minimum perl version in a cpanfile
by stevieb (Canon) on Jan 19, 2017 at 22:35 UTC

    What build tool are you using? I use ExtUtil::MakeMaker, and in my Makefile.PL, I add the following directive:

    MIN_PERL_VERSION => 5.010,

    ...and that seems to work for me.

      It's not going on cpan, so it's not going to use a build tool. No EUMM, no MB. Just "cpanm --installdeps ."

        If you were to use EUMM instead of cpanfile, cpanm --installdeps . would still work but you could specify your minimum Perl version.

        Your Makefile.PL can be as simple as

        use inc::Module::Install; name 'Dist-Name'; all_from 'lib/Dist/Name.pm'; do 'cpanfile'; ## as cpanfile uses Module::Install syntax perl_version '5.666'; ## make it die WriteAll;

        See Module::Install

Re: Requring minimum perl version in a cpanfile (cpanm bug)
by Anonymous Monk on Jan 20, 2017 at 02:11 UTC

    Is there a way to make it bail on the perl version, before it wastes time trying to install a bunch of modules?

    It doesn't appear that way

    Looks like a bug, like it should be checking perl version requirement before other requirements