line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1997746
|
use 5.006; # our |
|
2
|
|
|
|
|
6
|
|
2
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
43
|
|
3
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
163
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Author::KENTNL::Prereqs::Latest::Selective; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.001001'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: [DEPRECATED] Selectively upgrade a few modules to depend on the version used. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
515
|
use Moose qw( with ); |
|
2
|
|
|
|
|
303120
|
|
|
2
|
|
|
|
|
16
|
|
14
|
2
|
|
|
2
|
|
8744
|
use Module::Data; |
|
2
|
|
|
|
|
42269
|
|
|
2
|
|
|
|
|
85
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::PrereqSource'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
19
|
2
|
|
|
2
|
|
12
|
no Moose; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
13
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub wanted_latest { |
47
|
1
|
|
|
1
|
1
|
2
|
return { map { $_ => 1 } qw( Test::More Module::Build Dist::Zilla::PluginBundle::Author::KENTNL ) }; |
|
3
|
|
|
|
|
10
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub current_version_of { |
59
|
1
|
|
|
1
|
1
|
9
|
my ( undef, $package ) = @_; |
60
|
1
|
|
|
|
|
8
|
return Module::Data->new($package)->_version_emulate; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub for_each_dependency { |
85
|
1
|
|
|
1
|
1
|
10
|
my ( $self, $cpanmeta, $callback ) = @_; |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
2
|
my $prereqs = $cpanmeta->{prereqs}; |
88
|
1
|
|
|
|
|
1
|
for my $phase ( keys %{$prereqs} ) { |
|
1
|
|
|
|
|
4
|
|
89
|
1
|
|
|
|
|
1
|
my $phase_data = $prereqs->{$phase}; |
90
|
1
|
|
|
|
|
1
|
for my $type ( keys %{$phase_data} ) { |
|
1
|
|
|
|
|
2
|
|
91
|
1
|
|
|
|
|
2
|
my $type_data = $phase_data->{$type}; |
92
|
1
|
50
|
|
|
|
7
|
next unless $type_data->isa('CPAN::Meta::Requirements'); |
93
|
1
|
|
|
|
|
1
|
my $requirements = $type_data->{requirements}; |
94
|
1
|
|
|
|
|
12
|
for my $package ( keys %{$requirements} ) { |
|
1
|
|
|
|
|
3
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$callback->( |
97
|
|
|
|
|
|
|
$self, |
98
|
|
|
|
|
|
|
{ |
99
|
|
|
|
|
|
|
phase => $phase, |
100
|
|
|
|
|
|
|
type => $type, |
101
|
|
|
|
|
|
|
package => $package, |
102
|
1
|
|
|
|
|
6
|
requirement => $requirements->{$package}, |
103
|
|
|
|
|
|
|
}, |
104
|
|
|
|
|
|
|
); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
} |
108
|
1
|
|
|
|
|
17624
|
return $self; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# This needs to be 'our' to be localised. |
112
|
|
|
|
|
|
|
# Otherwise, we can't shadow the value of $in_recursion |
113
|
|
|
|
|
|
|
# using localisation, so we'd have to decrement $in_recursion at the |
114
|
|
|
|
|
|
|
# end, manually. |
115
|
|
|
|
|
|
|
# |
116
|
|
|
|
|
|
|
## no critic (ProhibitPackageVars,ProhibitLocalVars) |
117
|
|
|
|
|
|
|
our $in_recursion = 0; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub register_prereqs { |
130
|
1
|
50
|
33
|
1
|
1
|
40909
|
if ( defined $in_recursion and $in_recursion > 0 ) { |
131
|
0
|
|
|
|
|
0
|
return; |
132
|
|
|
|
|
|
|
} |
133
|
1
|
|
|
|
|
2
|
local $in_recursion = ( $in_recursion + 1 ); |
134
|
|
|
|
|
|
|
|
135
|
1
|
|
|
|
|
2
|
my $self = shift; |
136
|
1
|
|
|
|
|
31
|
my $prereqs = $self->zilla->prereqs; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$self->for_each_dependency( |
139
|
|
|
|
|
|
|
$prereqs->cpan_meta_prereqs => sub { |
140
|
1
|
|
|
1
|
|
1
|
my ( undef, $args ) = @_; |
141
|
1
|
|
|
|
|
2
|
my $package = $args->{package}; |
142
|
|
|
|
|
|
|
|
143
|
1
|
50
|
|
|
|
4
|
return unless exists $self->wanted_latest->{$package}; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
$self->zilla->register_prereqs( |
146
|
|
|
|
|
|
|
{ phase => $args->{phase}, type => $args->{type} }, |
147
|
1
|
|
|
|
|
30
|
$package, $self->current_version_of($package), |
148
|
|
|
|
|
|
|
); |
149
|
|
|
|
|
|
|
}, |
150
|
1
|
|
|
|
|
58
|
); |
151
|
1
|
|
|
|
|
11
|
return; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
1; |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
__END__ |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=pod |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=encoding UTF-8 |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 NAME |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Author::KENTNL::Prereqs::Latest::Selective - [DEPRECATED] Selectively upgrade a few modules to depend on the version used. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 VERSION |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
version 1.001001 |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 SYNOPSIS |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
[Autoprereqs] |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
[Author::KENTNL::Prereqs::Latest::Selective] |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This will automatically upgrade the minimum required version to the currently running version, for a selective list of packages, |
177
|
|
|
|
|
|
|
wherever they appear in dependencies. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Currently, the list of packages that will be upgraded to the current version are as follows: |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=over 4 |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item * Test::More - What I test all my packages with |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=item * Module::Build - The Installer I use for everything |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item * Dist::Zilla::PluginBundle::Author::KENTNL - The configuration setup I use for everything. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=back |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 DESCRIPTION |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This module is deprecated and no longer used by C<@Author::KENTNL> |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Instead, he recommends you use L<< C<[Prereqs::MatchInstalled]>|Dist::Zilla::Plugin::Prereqs::MatchInstalled >> |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 METHODS |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head2 wanted_latest |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
my $hash = $plugin->wanted_latest(); |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
A C<Hash> of Modules I want to be "Latest I've released with" |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
{ |
206
|
|
|
|
|
|
|
'Test::More' => 1, |
207
|
|
|
|
|
|
|
'Module::Build' => 1, |
208
|
|
|
|
|
|
|
'Dist::Zilla::PluginBundle::Author::KENTNL' => 1, |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 current_version_of |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
my $v = $plugin->current_version_of('Foo'); |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Returns the currently installed version of a given thing. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head2 for_each_dependency |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
$plugin->for_each_dependency( $cpan_meta, sub { |
220
|
|
|
|
|
|
|
my ( $self, $info ) = @_; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
printf "%s => %s\n", $_ , $info->{$_} for qw( phase type package requirement ) |
223
|
|
|
|
|
|
|
}); |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Utility for iterating all dependency specifications. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
Each dependency spec is passed as a C<HashRef> |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
{ |
230
|
|
|
|
|
|
|
phase => 'configure', |
231
|
|
|
|
|
|
|
type => 'requires', |
232
|
|
|
|
|
|
|
package => 'Module::Metadata', |
233
|
|
|
|
|
|
|
requirement => bless({}, 'CPAN::Meta::Requirements::_Range::_Range'); # or close. |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head2 register_prereqs |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
This module executes during C<prereqs> generation. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
As such, its advised to place it B<after> other things you want C<prereq>'s upgraded on. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
( Presently, it won't matter if you place it before, because it does some magic with phase emulation, but that might be removed one day ) |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=begin MetaPOD::JSON v1.1.0 |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
{ |
247
|
|
|
|
|
|
|
"namespace":"Dist::Zilla::Plugin::Author::KENTNL::Prereqs::Latest::Selective", |
248
|
|
|
|
|
|
|
"interface":"class", |
249
|
|
|
|
|
|
|
"inherits":["Moose::Object"], |
250
|
|
|
|
|
|
|
"does":["Dist::Zilla::Role::PrereqSource"] |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=end MetaPOD::JSON |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head1 AUTHOR |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>. |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
265
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=cut |