6

I'm working on my Net::Prober distribution, using dzil. From the next version I'd like to enforce a minimum requirement of perl 5.10+ (was 5.006), because I'm using named captures :-)

Now I have put use 5.010; at the top of my main module, and that's fine, but I was wondering: is there a way to specify a minimum perl interpreter version in the dist.ini file?

My current dist.ini is:

name    = Net-Prober
version = 0.07
...

[Prereqs]
Carp = 0
Data::Dumper = 0
Digest::MD5 = 0
IO::Socket::INET = 0
IO::Socket::SSL = 0
IO::Socket::UNIX = 0
LWPx::ParanoidAgent = 0
Net::Ping = 2.34
Sys::Syslog = 0

[Prereqs / TestRequires]
Test::More = 0
LWP::Online = 0

...

Can I just add perl = 5.010 to the [Prereq] block?

Cosimo
  • 2,846
  • 1
  • 24
  • 26
  • Dist::Zilla seems to accept `perl = 5.010` in the `[Prereq]` block AFAICS :) – Cosimo Jul 20 '12 at 07:27
  • 1
    You could use the `distmeta` function to add a `MIN_PERL_VERSION => '5.010'` directive to your module's metadata. The CPAN installers (any fairly recent version) will respect it. – DavidO Jul 20 '12 at 09:08
  • \[AutoPrereqs\] will also detect `use 5.010;` in any module. – Ether Jul 24 '12 at 19:48

1 Answers1

7

Can I just add perl = 5.010 to the [Prereq] block?

Yes, you can. Alternatively, there's the MinimumPerl plugin that autodetects the minimal version of perl that's required.

Leon Timmermans
  • 30,029
  • 2
  • 61
  • 110
  • 1
    The MinimumPerl plugin (via [Perl::MinimumVersion](http://metacpan.org/module/Perl::MinimumVersion)) is a bit out of date though.. for example it doesn't detect any features introduced in 5.14 (and possibly 5.12) or later. – Ether Jul 24 '12 at 19:46
  • @Ether: It does detect features from 5.12 (including the ... operator), but you're right it hasn't been updated for 5.14 or higher. I'm sure Adam accepts patches ;-) – Leon Timmermans Jul 26 '12 at 09:14
  • Looks like NEILB adopted this module in the meantime, so it has had some updates. – oalders Aug 01 '14 at 15:09