line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
3257084
|
use 5.008; |
|
2
|
|
|
|
|
8
|
|
2
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
51
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
151
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Test::MinimumVersion; # git description: v2.000009-3-gb990056 |
6
|
|
|
|
|
|
|
# ABSTRACT: Author tests for minimum required versions |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '2.000010'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
14
|
use Moose; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
27
|
|
11
|
|
|
|
|
|
|
with |
12
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileGatherer', |
13
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileMunger', |
14
|
|
|
|
|
|
|
'Dist::Zilla::Role::TextTemplate', |
15
|
|
|
|
|
|
|
'Dist::Zilla::Role::PrereqSource'; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
14102
|
use Sub::Exporter::ForMethods 'method_installer'; # method_installer returns a sub. |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
26
|
|
18
|
|
|
|
|
|
|
use Data::Section 0.004 # fixed header_re |
19
|
2
|
|
|
2
|
|
515
|
{ installer => method_installer }, '-setup'; |
|
2
|
|
|
|
|
56
|
|
|
2
|
|
|
|
|
14
|
|
20
|
2
|
|
|
2
|
|
1902
|
use List::Util 'first'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
195
|
|
21
|
2
|
|
|
2
|
|
21
|
use Moose::Util::TypeConstraints 'role_type'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
23
|
|
22
|
2
|
|
|
2
|
|
925
|
use namespace::autoclean; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
23
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has max_target_perl => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
isa => 'Str', |
27
|
|
|
|
|
|
|
predicate => 'has_max_target_perl', |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
2
|
|
284
|
use constant FILENAME => 'xt/author/minimum-version.t'; # could be configurable, someday.. |
|
2
|
|
|
|
|
26
|
|
|
2
|
|
|
|
|
976
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
around dump_config => sub |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
my ($orig, $self) = @_; |
35
|
|
|
|
|
|
|
my $config = $self->$orig; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$config->{+__PACKAGE__} = +{ |
38
|
|
|
|
|
|
|
max_target_perl => $self->max_target_perl, |
39
|
|
|
|
|
|
|
blessed($self) ne __PACKAGE__ ? ( version => $VERSION ) : (), |
40
|
|
|
|
|
|
|
}; |
41
|
|
|
|
|
|
|
return $config; |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has _file => ( |
45
|
|
|
|
|
|
|
is => 'rw', isa => role_type('Dist::Zilla::Role::File'), |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub gather_files |
49
|
|
|
|
|
|
|
{ |
50
|
4
|
|
|
4
|
0
|
175140
|
my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
4
|
|
|
|
|
1187
|
require Dist::Zilla::File::InMemory; |
53
|
|
|
|
|
|
|
$self->add_file($self->_file( |
54
|
|
|
|
|
|
|
Dist::Zilla::File::InMemory->new( |
55
|
|
|
|
|
|
|
name => FILENAME, |
56
|
4
|
|
|
|
|
191529
|
content => ${$self->section_data(FILENAME)}, |
|
4
|
|
|
|
|
39
|
|
57
|
|
|
|
|
|
|
)) |
58
|
|
|
|
|
|
|
); |
59
|
4
|
|
|
|
|
1661
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub munge_file |
63
|
|
|
|
|
|
|
{ |
64
|
12
|
|
|
12
|
0
|
9860
|
my ($self, $file) = @_; |
65
|
|
|
|
|
|
|
|
66
|
12
|
100
|
|
|
|
448
|
return unless $file == $self->_file; |
67
|
4
|
|
|
|
|
26
|
$file->content( |
68
|
|
|
|
|
|
|
$self->fill_in_string( |
69
|
|
|
|
|
|
|
$file->content, |
70
|
|
|
|
|
|
|
{ (version => $self->max_target_perl)x!!$self->has_max_target_perl } |
71
|
|
|
|
|
|
|
) |
72
|
|
|
|
|
|
|
); |
73
|
4
|
|
|
|
|
5689
|
return; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#pod =for Pod::Coverage register_prereqs |
77
|
|
|
|
|
|
|
#pod |
78
|
|
|
|
|
|
|
#pod =cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub register_prereqs { |
81
|
4
|
|
|
4
|
0
|
2104
|
my $self = shift; |
82
|
4
|
|
|
|
|
138
|
$self->zilla->register_prereqs( |
83
|
|
|
|
|
|
|
{ |
84
|
|
|
|
|
|
|
type => 'requires', |
85
|
|
|
|
|
|
|
phase => 'develop', |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
'Test::MinimumVersion' => 0, |
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
92
|
|
|
|
|
|
|
1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
95
|
|
|
|
|
|
|
#pod |
96
|
|
|
|
|
|
|
#pod In C<dist.ini>: |
97
|
|
|
|
|
|
|
#pod |
98
|
|
|
|
|
|
|
#pod [Test::MinimumVersion] |
99
|
|
|
|
|
|
|
#pod max_target_perl = 5.10.1 |
100
|
|
|
|
|
|
|
#pod |
101
|
|
|
|
|
|
|
#pod 1; |
102
|
|
|
|
|
|
|
#pod __END__ |
103
|
|
|
|
|
|
|
#pod |
104
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
105
|
|
|
|
|
|
|
#pod |
106
|
|
|
|
|
|
|
#pod =for Pod::Coverage FILENAME gather_files munge_file register_prereqs |
107
|
|
|
|
|
|
|
#pod |
108
|
|
|
|
|
|
|
#pod This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing a |
109
|
|
|
|
|
|
|
#pod L<Test::MinimumVersion> test: |
110
|
|
|
|
|
|
|
#pod |
111
|
|
|
|
|
|
|
#pod xt/author/minimum-version.t - a standard Test::MinimumVersion test |
112
|
|
|
|
|
|
|
#pod |
113
|
|
|
|
|
|
|
#pod You should provide the highest perl version you want to require as |
114
|
|
|
|
|
|
|
#pod C<target_max_version>. If you accidentally use perl features that are newer |
115
|
|
|
|
|
|
|
#pod than that version number, then the test will fail, and you can go change |
116
|
|
|
|
|
|
|
#pod whatever bumped up the minimum perl version required. |
117
|
|
|
|
|
|
|
#pod |
118
|
|
|
|
|
|
|
#pod =cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=pod |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=encoding UTF-8 |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 NAME |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Test::MinimumVersion - Author tests for minimum required versions |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 VERSION |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
version 2.000010 |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 SYNOPSIS |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
In C<dist.ini>: |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
[Test::MinimumVersion] |
137
|
|
|
|
|
|
|
max_target_perl = 5.10.1 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |
140
|
|
|
|
|
|
|
__END__ |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 DESCRIPTION |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=for Pod::Coverage register_prereqs |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=for Pod::Coverage FILENAME gather_files munge_file register_prereqs |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing a |
149
|
|
|
|
|
|
|
L<Test::MinimumVersion> test: |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
xt/author/minimum-version.t - a standard Test::MinimumVersion test |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
You should provide the highest perl version you want to require as |
154
|
|
|
|
|
|
|
C<target_max_version>. If you accidentally use perl features that are newer |
155
|
|
|
|
|
|
|
than that version number, then the test will fail, and you can go change |
156
|
|
|
|
|
|
|
whatever bumped up the minimum perl version required. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 SUPPORT |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Test-MinimumVersion> |
161
|
|
|
|
|
|
|
(or L<bug-Dist-Zilla-Plugin-Test-MinimumVersion@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-Test-MinimumVersion@rt.cpan.org>). |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
164
|
|
|
|
|
|
|
L<http://dzil.org/#mailing-list>. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
167
|
|
|
|
|
|
|
L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 AUTHORS |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=over 4 |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item * |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Mike Doherty <doherty@cpan.org> |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Marcel Grünauer <marcel@cpan.org> |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=back |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=for stopwords Karen Etheridge Marcel Gruenauer Chris Weyl Kent Fredric |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=over 4 |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item * |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item * |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Marcel Gruenauer <hanekomu@gmail.com> |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item * |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Chris Weyl <cweyl@alumni.drew.edu> |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item * |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Kent Fredric <kentfredric@gmail.com> |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=back |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Mike Doherty. |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
212
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=cut |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
__DATA__ |
217
|
|
|
|
|
|
|
___[ xt/author/minimum-version.t ]___ |
218
|
|
|
|
|
|
|
use strict; |
219
|
|
|
|
|
|
|
use warnings; |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
use Test::More; |
222
|
|
|
|
|
|
|
use Test::MinimumVersion; |
223
|
|
|
|
|
|
|
{{ $version |
224
|
|
|
|
|
|
|
? "all_minimum_version_ok( qq{$version} );" |
225
|
|
|
|
|
|
|
: "all_minimum_version_from_metayml_ok();" |
226
|
|
|
|
|
|
|
}} |