Skip to content

Commit 3c30ec5

Browse files
committed
Introduce helper function requires_by_perl
Function allows to specify multiple required version based on Perl version. Usable when module changes their Perl requirements.
1 parent 44ac2a0 commit 3c30ec5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cpanfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
use strict; # satisfy linter
22
use warnings; # satisfy linter
33

4+
sub requires_by_perl {
5+
my @requires = (shift);
6+
7+
while (@_) {
8+
shift, next
9+
unless @_ == 1 && $] < shift
10+
;
11+
12+
push @requires, shift // return;
13+
last;
14+
}
15+
16+
requires @requires;
17+
}
18+
419
# Last versions which install on < 5.12
520
if ( "$]" < 5.012 ) {
621
requires 'Data::Section', '==0.200007';

0 commit comments

Comments
 (0)