Skip to content

Commit f367bec

Browse files
committed
test, doc, make warning if version range and not req EUMM >= 7.11_01
1 parent b62ffb3 commit f367bec

File tree

4 files changed

+56
-6
lines changed

4 files changed

+56
-6
lines changed

Changes

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
7.11_06
2+
3+
Enhancements:
4+
- Warn if use version range but no specify minimum EUMM >= 7.11_01
5+
16
7.11_05 Sat Mar 19 09:41:02 GMT 2016
27

38
Bug fixes:

lib/ExtUtils/MakeMaker.pm

+21-1
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,22 @@ sub _has_cpan_meta_requirements {
427427
};
428428
}
429429

430+
sub _min_EUMM {
431+
my ($self) = @_;
432+
my @eumm_versions = sort grep defined, map {
433+
$_->{'ExtUtils::MakeMaker'}
434+
} grep defined, @{$self}{qw(CONFIGURE_REQUIRES)};
435+
return 0 unless @eumm_versions;
436+
$eumm_versions[0];
437+
}
438+
439+
sub _got_version_ranges {
440+
my ($self) = @_;
441+
my @all_versions = map values %$_, grep defined, @{$self}{@PREREQ_KEYS};
442+
return 0 unless @all_versions;
443+
grep /[^v\d\._]/, @all_versions;
444+
}
445+
430446
sub new {
431447
my($class,$self) = @_;
432448
my($key);
@@ -447,6 +463,9 @@ sub new {
447463
# Cleanup all the module requirement bits
448464
my %key2cmr;
449465
my $has_cpan_meta_requirements = _has_cpan_meta_requirements;
466+
warn "Warning: version range without prerequisite of EUMM >= 7.11_01"
467+
if $has_cpan_meta_requirements and $self->_min_EUMM lt 7.1101
468+
and $self->_got_version_ranges;
450469
for my $key (@PREREQ_KEYS) {
451470
$self->{$key} ||= {};
452471
if ($has_cpan_meta_requirements) {
@@ -2684,7 +2703,8 @@ A hash of modules that are needed to run your module. The keys are
26842703
the module names ie. Test::More, and the minimum version is the
26852704
value. If the required version number is 0 any version will do.
26862705
The versions given may be a Perl v-string (see L<version>) or a range
2687-
(see L<CPAN::Meta::Requirements>).
2706+
(see L<CPAN::Meta::Requirements>). If you give a range, you need to
2707+
specify a minimum EUMM of at least C<7.11_01> in C<CONFIGURE_REQUIRES>.
26882708
26892709
This will go into the C<requires> field of your F<META.yml> and the
26902710
C<runtime> of the C<prereqs> field of your F<META.json>.

t/prereq.t

+28-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ BEGIN {
99

1010
use strict;
1111
use Config;
12-
use Test::More tests => 21;
12+
use Test::More tests => 23;
1313
use File::Temp qw[tempdir];
1414

1515
use TieOut;
@@ -57,7 +57,7 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
5757
is $warnings, '', 'basic prereq';
5858

5959
SKIP: {
60-
skip 'No CMR, no version ranges', 1
60+
skip 'No CMR, no version ranges', 3
6161
unless ExtUtils::MakeMaker::_has_cpan_meta_requirements;
6262
$warnings = '';
6363
WriteMakefile(
@@ -66,15 +66,39 @@ ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
6666
strict => '>= 0, <= 99999',
6767
}
6868
);
69-
is $warnings, '', 'version range';
69+
isnt $warnings, '', 'version range, no min EUMM specified';
70+
71+
$warnings = '';
72+
WriteMakefile(
73+
NAME => 'Big::Dummy',
74+
PREREQ_PM => {
75+
strict => '>= 0, <= 99999',
76+
},
77+
CONFIGURE_REQUIRES => {
78+
'ExtUtils::MakeMaker' => '7.04',
79+
},
80+
);
81+
isnt $warnings, '', 'version range and insufficient EUMM specified';
82+
83+
$warnings = '';
84+
WriteMakefile(
85+
NAME => 'Big::Dummy',
86+
PREREQ_PM => {
87+
strict => '>= 0, <= 99999',
88+
},
89+
CONFIGURE_REQUIRES => {
90+
'ExtUtils::MakeMaker' => '7.11_01',
91+
},
92+
);
93+
is $warnings, '', 'version range and sufficient EUMM specified';
7094
}
7195

7296
$warnings = '';
7397
WriteMakefile(
7498
NAME => 'Big::Dummy',
7599
PREREQ_PM => {
76100
strict => 99999
77-
}
101+
},
78102
);
79103
is $warnings,
80104
sprintf("Warning: prerequisite strict 99999 not found. We have %s.\n",

t/vstrings.t

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ sub capture_make {
7575

7676
WriteMakefile(
7777
NAME => 'VString::Test',
78-
PREREQ_PM => { $package , $version }
78+
PREREQ_PM => { $package , $version },
79+
CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => 7.1101 },
7980
);
8081

8182
return $warnings;

0 commit comments

Comments
 (0)