11use strict; # satisfy linter
22use warnings; # satisfy linter
33
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+ requires_by_perl ' Pod::Man' ,
37+ prior 5.010 => ' ==4.14' ,
38+ prior 5.012 => ' ==5.01' ,
39+ ;
40+
441# Last versions which install on < 5.12
542if ( " $] " < 5.012 ) {
643 requires ' Data::Section' , ' ==0.200007' ;
@@ -16,11 +53,9 @@ else {
1653}
1754
1855if ( " $] " >= 5.010 ) {
19- requires ' Pod::Man' , ' >= 5.00' ;
2056 requires ' Perl::Critic' , ' >= 1.144' ;
2157}
2258else {
23- requires ' Pod::Man' , ' ==4.14' ;
2459 requires ' Perl::Critic' , ' ==1.142' ;
2560}
2661
@@ -42,7 +77,6 @@ requires 'Test::Differences';
4277requires ' Test::EOL' ;
4378requires ' Test::Fatal' ;
4479requires ' Test::MinimumVersion' ;
45- requires ' Test::MockModule' ;
4680requires ' Test::Mojibake' ;
4781requires ' Test::More' ;
4882requires ' Test::Needs' ;
@@ -58,19 +92,32 @@ requires 'Test::Synopsis';
5892requires ' Test::Version' ;
5993requires ' Test::Warnings' ;
6094
95+ requires_by_perl ' Devel::Cover' ,
96+ prior 5.010 => do_not_install,
97+ prior 5.012 => ' ==1.42' ,
98+ ;
99+
100+ requires_by_perl ' Test::MockModule' ,
101+ prior 5.012 => ' ==0.178' ,
102+ ;
103+
104+ requires_by_perl ' Test2::Harness' ,
105+ prior 5.010 => do_not_install,
106+ prior 5.014 => ' ==1.000156' ,
107+ ;
108+
109+ requires_by_perl ' Test2::Harness::Renderer::JUnit' ,
110+ prior 5.010001 => do_not_install,
111+ prior 5.014 => ' ==1.000005' ,
112+ ;
113+
61114if ( " $] " >= 5.010 ) {
62- requires ' Devel::Cover' ;
63115 requires ' Devel::Cover::Report::Codecov' ;
64116 requires ' Devel::Cover::Report::Coveralls' ;
65117 requires ' Minilla' ;
66- requires ' Test2::Harness' ;
67118 requires ' Test::Vars' ;
68119}
69120
70- if ( " $] " >= 5.010001 ) {
71- requires ' Test2::Harness::Renderer::JUnit' ;
72- }
73-
74121if ( " $] " >= 5.012 ) {
75122 requires ' Code::TidyAll::Plugin::SortLines::Naturally' ;
76123 requires ' Code::TidyAll::Plugin::Test::Vars' ;
@@ -88,12 +135,12 @@ if ( "$]" >= 5.020 ) {
88135 requires ' Dist::Zilla::PluginBundle::DROLSKY' ;
89136 requires ' Dist::Zilla::PluginBundle::Milla' ;
90137
91- if ( " $] " < 5.026 ) {
92- requires ' Dist::Zilla::PluginBundle::RJBS ' , ' ==5.023 ' ;
93- }
94- else {
95- requires ' Dist::Zilla::PluginBundle::RJBS ' ;
96- }
138+ requires_by_perl ' Dist::Zilla::PluginBundle::RJBS ' ,
139+ prior 5. 020 => do_not_install,
140+ prior 5. 026 => ' ==5.023 ' ,
141+ prior 5. 034 => ' ==5.025 ' ,
142+ otherwise ' >5.028 ' # 5.028 requires v5.36 whereas following versions only v5.34, so omit it
143+ ;
97144
98145 requires ' Dist::Zilla::PluginBundle::Starter::Git' ;
99146 requires ' Dist::Zilla::Plugin::CheckChangeLog' ;
0 commit comments