We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
requires_by_perl
1 parent 1bec90b commit b29ca71Copy full SHA for b29ca71
cpanfile
@@ -1,6 +1,38 @@
1
use strict; # satisfy linter
2
use warnings; # satisfy linter
3
4
+=pod
5
+
6
+Semantic sugar to simplify management of modules which changed their required Perl version
7
+(directly or via dependencies)
8
9
+ requires_by_perl Module,
10
+ prior 5.010 => 'use version X',
11
+ prior 5.012 => 'use version Y',
12
+ otherwise do_not_install
13
+ ;
14
15
+=cut
16
17
+sub requires_by_perl {
18
+ my @requires = (shift);
19
20
+ while (@_) {
21
+ shift, next
22
+ unless @_ == 1 || $] < shift
23
24
25
+ push @requires, shift // return;
26
+ last;
27
+ }
28
29
+ requires @requires;
30
+}
31
32
+sub prior { @_ }
33
+sub otherwise { @_ }
34
+sub do_not_install { undef }
35
36
# Last versions which install on < 5.12
37
if ( "$]" < 5.012 ) {
38
requires 'Data::Section', '==0.200007';
0 commit comments