line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Midgen; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
41848
|
use 5.008001; |
|
2
|
|
|
|
|
8
|
|
4
|
2
|
|
|
|
|
281
|
use constant {BLANK => q{ }, NONE => q{}, TWO => 2, THREE => 3, TRUE => 1, |
5
|
2
|
|
|
2
|
|
12
|
FALSE => 0,}; |
|
2
|
|
|
|
|
3
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1335
|
use Moo; |
|
2
|
|
|
|
|
27892
|
|
|
2
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
with qw( |
9
|
|
|
|
|
|
|
App::Midgen::Role::Options |
10
|
|
|
|
|
|
|
App::Midgen::Role::Attributes |
11
|
|
|
|
|
|
|
App::Midgen::Role::AttributesX |
12
|
|
|
|
|
|
|
App::Midgen::Role::InDistribution |
13
|
|
|
|
|
|
|
App::Midgen::Role::TestRequires |
14
|
|
|
|
|
|
|
App::Midgen::Role::UseOk |
15
|
|
|
|
|
|
|
App::Midgen::Role::Eval |
16
|
|
|
|
|
|
|
App::Midgen::Role::FindMinVersion |
17
|
|
|
|
|
|
|
App::Midgen::Role::Output |
18
|
|
|
|
|
|
|
App::Midgen::Role::UseModule |
19
|
|
|
|
|
|
|
App::Midgen::Role::Experimental |
20
|
|
|
|
|
|
|
App::Midgen::Role::Heuristics |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Load time and dependencies negate execution time |
24
|
|
|
|
|
|
|
# use namespace::clean -except => 'meta'; |
25
|
2
|
|
|
2
|
|
2951
|
use version; |
|
2
|
|
|
|
|
3089
|
|
|
2
|
|
|
|
|
9
|
|
26
|
|
|
|
|
|
|
our $VERSION = '0.33_05'; |
27
|
|
|
|
|
|
|
$VERSION = eval $VERSION; ## no critic |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
2
|
|
135
|
use English qw( -no_match_vars ); # Avoids reg-ex performance penalty |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
30
|
|
|
|
|
|
|
local $OUTPUT_AUTOFLUSH = 1; |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
2
|
|
643
|
use Cwd qw(getcwd); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
85
|
|
33
|
2
|
|
|
2
|
|
1150
|
use Data::Printer {caller_info => 1,}; |
|
2
|
|
|
|
|
53546
|
|
|
2
|
|
|
|
|
40
|
|
34
|
2
|
|
|
2
|
|
1799
|
use File::Find qw(find); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
113
|
|
35
|
2
|
|
|
2
|
|
8
|
use File::Spec; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
30
|
|
36
|
2
|
|
|
2
|
|
4472
|
use Module::CoreList; |
|
2
|
|
|
|
|
82018
|
|
|
2
|
|
|
|
|
19
|
|
37
|
2
|
|
|
2
|
|
2519
|
use PPI; |
|
2
|
|
|
|
|
207301
|
|
|
2
|
|
|
|
|
76
|
|
38
|
2
|
|
|
2
|
|
14
|
use Term::ANSIColor qw( :constants colored colorstrip ); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
644
|
|
39
|
2
|
|
|
2
|
|
11
|
use Try::Tiny; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
102
|
|
40
|
2
|
|
|
2
|
|
979
|
use Tie::Static qw(static); |
|
2
|
|
|
|
|
8828
|
|
|
2
|
|
|
|
|
106
|
|
41
|
2
|
|
|
2
|
|
12
|
use version; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
14
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# stop rlib from Fing all over cwd |
44
|
|
|
|
|
|
|
our $Working_Dir = getcwd(); |
45
|
|
|
|
|
|
|
our $Min_Version = 0; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
####### |
49
|
|
|
|
|
|
|
# run |
50
|
|
|
|
|
|
|
####### |
51
|
|
|
|
|
|
|
sub run { |
52
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$self->_initialise(); |
55
|
|
|
|
|
|
|
try { |
56
|
0
|
|
|
0
|
|
|
$self->first_package_name(); |
57
|
0
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$self->find_runtime_modules(); |
61
|
0
|
|
|
|
|
|
$self->find_test_modules(); |
62
|
0
|
0
|
|
|
|
|
$self->find_develop_modules() if $self->experimental; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#now for some Heuristics :) |
65
|
|
|
|
|
|
|
$self->recast_to_runtimerequires($self->{RuntimeRequires}, |
66
|
0
|
|
|
|
|
|
$self->{RuntimeRecommends}); |
67
|
0
|
|
|
|
|
|
$self->recast_to_testrequires($self->{TestRequires}, $self->{TestSuggests}); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Now we have switched to MetaCPAN-Api we can hunt for noisy children in tests |
70
|
0
|
0
|
|
|
|
|
if ($self->experimental) { |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$self->remove_noisy_children($self->{RuntimeRequires}); |
73
|
0
|
|
|
|
|
|
$self->remove_twins($self->{RuntimeRequires}); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Run a second time if we found any twins, this will sort out twins and triplets etc |
76
|
|
|
|
|
|
|
$self->remove_noisy_children($self->{RuntimeRequires}) |
77
|
0
|
0
|
|
|
|
|
if $self->found_twins; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
foreach (qw( TestRequires TestSuggests DevelopRequires )) { |
80
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
p $self->{$_} if $self->debug; |
82
|
0
|
|
|
|
|
|
$self->remove_noisy_children($self->{$_}); |
83
|
0
|
|
|
|
|
|
foreach my $module (keys %{$self->{$_}}) { |
|
0
|
|
|
|
|
|
|
84
|
0
|
0
|
|
|
|
|
if ($self->{RuntimeRequires}{$module}) { |
85
|
0
|
0
|
|
|
|
|
warn $module if $self->debug; |
86
|
|
|
|
|
|
|
try { |
87
|
0
|
|
|
0
|
|
|
delete $self->{$_}{$module}; |
88
|
0
|
|
|
|
|
|
}; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
0
|
0
|
|
|
|
|
p $self->{$_} if $self->debug; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# display chosen output format |
96
|
0
|
|
|
|
|
|
$self->output_header(); |
97
|
0
|
|
|
|
|
|
$self->output_main_body('RuntimeRequires', $self->{RuntimeRequires}); |
98
|
|
|
|
|
|
|
$self->output_main_body('RuntimeRecommends', $self->{RuntimeRecommends}) |
99
|
0
|
0
|
|
|
|
|
if $self->meta2; |
100
|
0
|
|
|
|
|
|
$self->output_main_body('TestRequires', $self->{TestRequires}); |
101
|
0
|
0
|
|
|
|
|
if ($self->meta2) { |
102
|
0
|
|
|
|
|
|
$self->output_main_body('TestSuggests', $self->{TestSuggests}); |
103
|
0
|
|
|
|
|
|
$self->output_main_body('Close', {}); |
104
|
0
|
|
|
|
|
|
$self->output_main_body('DevelopRequires', $self->{DevelopRequires}); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
else { |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# concatenate hashes |
109
|
|
|
|
|
|
|
try { |
110
|
0
|
|
|
0
|
|
|
%{$self->{recommends}} = (%{$self->{RuntimeRecommends}},); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
}; |
112
|
|
|
|
|
|
|
try { |
113
|
0
|
|
|
|
|
|
%{$self->{recommends}} |
114
|
0
|
|
|
0
|
|
|
= (%{$self->{recommends}}, %{$self->{TestSuggests}},); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
}; |
116
|
|
|
|
|
|
|
try { |
117
|
0
|
|
|
|
|
|
%{$self->{recommends}} |
118
|
0
|
|
|
0
|
|
|
= (%{$self->{recommends}}, %{$self->{DevelopRequires}},); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
}; |
120
|
0
|
|
|
|
|
|
$self->output_main_body('recommends', $self->{recommends}); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
$self->output_footer(); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
#now for tidy-up Heuristics :) |
126
|
0
|
0
|
0
|
|
|
|
$self->remove_inc_mi() if ( $self->{format} eq 'dsl' or 'mi' ); |
127
|
|
|
|
|
|
|
|
128
|
0
|
0
|
|
|
|
|
p $self->{modules} if ($self->verbose == TWO); |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
return; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
####### |
134
|
|
|
|
|
|
|
# initialise |
135
|
|
|
|
|
|
|
####### |
136
|
|
|
|
|
|
|
sub _initialise { |
137
|
0
|
|
|
0
|
|
|
my $self = shift; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# let's give Output a copy, to stop it being F'up as well, suspect Tiny::Path as-well rlib |
140
|
0
|
0
|
|
|
|
|
warn 'working in dir: ' . $Working_Dir if $self->debug; |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
return; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
####### |
146
|
|
|
|
|
|
|
# first_package_name |
147
|
|
|
|
|
|
|
####### |
148
|
|
|
|
|
|
|
sub first_package_name { |
149
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
try { |
152
|
|
|
|
|
|
|
find( |
153
|
0
|
|
|
|
|
|
sub { _find_package_names($self); }, |
154
|
0
|
|
|
0
|
|
|
File::Spec->catfile($Working_Dir, 'lib') |
155
|
|
|
|
|
|
|
); |
156
|
0
|
|
|
|
|
|
}; |
157
|
|
|
|
|
|
|
|
158
|
0
|
0
|
|
|
|
|
p $self->package_names if $self->debug; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# We will assume the first package found is our Package Name, pot lock :) |
161
|
|
|
|
|
|
|
# due to Milla not being a dist we go and get dist-name |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
try { |
164
|
0
|
|
|
0
|
|
|
my $is_package_name = $self->package_names->[0]; |
165
|
0
|
|
|
|
|
|
$is_package_name =~ s{::}{-}g; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
# MetaCPAN::Client expects hyphens in distribution search |
168
|
0
|
|
|
|
|
|
my $mcpan_dist_info = $self->mcpan->distribution($is_package_name); |
169
|
0
|
|
|
|
|
|
my $distribution_name = $mcpan_dist_info->name(); |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
|
$distribution_name =~ s{-}{::}g; |
172
|
0
|
|
|
|
|
|
$self->_set_distribution_name($distribution_name); |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
catch { |
175
|
0
|
|
|
0
|
|
|
$self->_set_distribution_name($self->package_names->[0]); |
176
|
0
|
|
|
|
|
|
}; |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
# I still want to see package name even though infile sets verbose = 0 |
179
|
0
|
0
|
0
|
|
|
|
print 'Package: ' . $self->distribution_name . "\n" |
180
|
|
|
|
|
|
|
if $self->verbose |
181
|
|
|
|
|
|
|
or $self->format eq 'infile'; |
182
|
|
|
|
|
|
|
|
183
|
0
|
|
|
|
|
|
return; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
####### |
186
|
|
|
|
|
|
|
# find_package_name |
187
|
|
|
|
|
|
|
####### |
188
|
|
|
|
|
|
|
sub _find_package_names { |
189
|
0
|
|
|
0
|
|
|
my $self = shift; |
190
|
0
|
|
|
|
|
|
my $filename = $_; |
191
|
0
|
|
|
|
|
|
static \my $files_checked; |
192
|
0
|
0
|
|
|
|
|
if (defined $files_checked) { |
193
|
0
|
0
|
|
|
|
|
return if $files_checked >= THREE; |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
# Only check in pm files |
197
|
0
|
0
|
|
|
|
|
return if $filename !~ /[.]pm$/sxm; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
# Load a Document from a file |
200
|
0
|
|
|
|
|
|
$self->_set_ppi_document(PPI::Document->new($filename)); |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
# Extract package names |
203
|
0
|
|
|
|
|
|
push @{$self->package_names}, |
|
0
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
$self->ppi_document->find_first('PPI::Statement::Package')->namespace; |
205
|
0
|
|
|
|
|
|
$files_checked++; |
206
|
|
|
|
|
|
|
|
207
|
0
|
|
|
|
|
|
return; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
####### |
212
|
|
|
|
|
|
|
# find_runtime_modules |
213
|
|
|
|
|
|
|
####### |
214
|
|
|
|
|
|
|
sub find_runtime_modules { |
215
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
my @posiable_directories_to_search |
218
|
0
|
|
|
|
|
|
= map { File::Spec->catfile($Working_Dir, $_) } |
|
0
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
qw( bin share script lib ); |
220
|
|
|
|
|
|
|
|
221
|
0
|
|
|
|
|
|
my @directories_to_search = (); |
222
|
0
|
|
|
|
|
|
foreach my $directory (@posiable_directories_to_search) { |
223
|
0
|
0
|
|
|
|
|
if (defined -d $directory) { |
224
|
0
|
|
|
|
|
|
push @directories_to_search, $directory; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
} |
227
|
0
|
0
|
|
|
|
|
p @directories_to_search if $self->debug; |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
try { |
230
|
0
|
|
|
0
|
|
|
find(sub { _find_runtime_requirments($self); }, @directories_to_search); |
|
0
|
|
|
|
|
|
|
231
|
0
|
|
|
|
|
|
}; |
232
|
|
|
|
|
|
|
|
233
|
0
|
|
|
|
|
|
return; |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
####### |
237
|
|
|
|
|
|
|
# _find_runtime_requirments |
238
|
|
|
|
|
|
|
####### |
239
|
|
|
|
|
|
|
sub _find_runtime_requirments { |
240
|
0
|
|
|
0
|
|
|
my $self = shift; |
241
|
0
|
|
|
|
|
|
my $filename = $_; |
242
|
|
|
|
|
|
|
|
243
|
0
|
0
|
|
|
|
|
return if $self->is_perlfile($filename) == FALSE; |
244
|
|
|
|
|
|
|
|
245
|
0
|
|
|
|
|
|
my $relative_dir = $File::Find::dir; |
246
|
0
|
|
|
|
|
|
$relative_dir =~ s/$Working_Dir//; |
247
|
0
|
|
|
|
|
|
$self->_set_looking_infile(File::Spec->catfile($relative_dir, $filename)); |
248
|
0
|
|
|
|
|
|
$self->_set_ppi_document(PPI::Document->new($filename)); |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
# do extra test early check for use_module before hand |
251
|
0
|
|
|
|
|
|
$self->xtests_use_module('RuntimeRecommends'); |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
# ToDo add eval/try here -> prereqs { runtime { suggests or recommends {...}}} |
254
|
0
|
|
|
|
|
|
$self->xtests_eval('RuntimeRecommends'); |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
# normal pps -> RuntimeRequires |
257
|
0
|
|
|
|
|
|
my $prereqs = $self->scanner->scan_ppi_document($self->ppi_document); |
258
|
0
|
|
|
|
|
|
my @modules = $prereqs->required_modules; |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
261
|
0
|
|
|
|
|
|
foreach my $mod_ver (@modules) { |
262
|
0
|
|
|
|
|
|
$self->{found_version}{$mod_ver} |
263
|
|
|
|
|
|
|
= $prereqs->requirements_for_module($mod_ver); |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
0
|
|
|
|
|
|
$self->{skip_not_mcpan_stamp} = 0; |
267
|
|
|
|
|
|
|
|
268
|
0
|
0
|
|
|
|
|
if (grep { $_ =~ m/^Dist::Zilla::Role::PluginBundle/ } @modules) { |
|
0
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
|
270
|
0
|
|
|
|
|
|
$self->{skip_not_mcpan_stamp} = 1; |
271
|
|
|
|
|
|
|
|
272
|
0
|
|
|
|
|
|
my $ppi_tqs = $self->ppi_document->find('PPI::Token::Quote::Single'); |
273
|
0
|
0
|
|
|
|
|
if ($ppi_tqs) { |
274
|
|
|
|
|
|
|
|
275
|
0
|
|
|
|
|
|
foreach my $include (@{$ppi_tqs}) { |
|
0
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
|
277
|
0
|
|
|
|
|
|
my $module = $include->content; |
278
|
0
|
|
|
|
|
|
$module =~ s/^[']//; |
279
|
0
|
|
|
|
|
|
$module =~ s/[']$//; |
280
|
|
|
|
|
|
|
|
281
|
0
|
0
|
|
|
|
|
next if $module =~ m/^Dist::Zilla::Role::PluginBundle/; |
282
|
0
|
0
|
|
|
|
|
next if $module =~ m{\A[-|:|\d]}; |
283
|
0
|
0
|
|
|
|
|
next if $module !~ m{\A(?:[[a-zA-Z])}; |
284
|
0
|
0
|
|
|
|
|
next if $module =~ m{[.|$|\\|/|\-|\[|%|@|]}; |
285
|
0
|
0
|
|
|
|
|
next if $module eq NONE; |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
|
|
|
push @modules, 'Dist::Zilla::Plugin::' . $module; |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
|
292
|
0
|
0
|
|
|
|
|
if (scalar @modules > 0) { |
293
|
0
|
|
|
|
|
|
for (0 .. $#modules) { |
294
|
|
|
|
|
|
|
try { |
295
|
0
|
|
|
0
|
|
|
$self->_process_found_modules('RuntimeRequires', $modules[$_], |
296
|
|
|
|
|
|
|
$prereqs->requirements_for_module($modules[$_]), |
297
|
|
|
|
|
|
|
'Perl::PrereqScanner', 'RuntimeRequires',); |
298
|
0
|
|
|
|
|
|
}; |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
} |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
#run pmv now |
303
|
0
|
0
|
|
|
|
|
$self->min_version($self->looking_infile) if $self->format ne 'infile'; |
304
|
|
|
|
|
|
|
|
305
|
0
|
|
|
|
|
|
return; |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
####### |
310
|
|
|
|
|
|
|
# find_test_modules |
311
|
|
|
|
|
|
|
####### |
312
|
|
|
|
|
|
|
sub find_test_modules { |
313
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
314
|
|
|
|
|
|
|
|
315
|
0
|
|
|
|
|
|
my $directory = 't'; |
316
|
0
|
0
|
|
|
|
|
if (defined -d $directory) { |
317
|
|
|
|
|
|
|
|
318
|
0
|
|
|
0
|
|
|
find(sub { _find_test_develop_requirments($self, $directory); }, |
319
|
0
|
|
|
|
|
|
$directory); |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
0
|
|
|
|
|
|
return; |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
####### |
327
|
|
|
|
|
|
|
# find_develop_modules |
328
|
|
|
|
|
|
|
####### |
329
|
|
|
|
|
|
|
sub find_develop_modules { |
330
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
331
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
my $directory = 'xt'; |
333
|
0
|
0
|
|
|
|
|
if (defined -d $directory) { |
334
|
|
|
|
|
|
|
|
335
|
0
|
|
|
0
|
|
|
find(sub { _find_test_develop_requirments($self, $directory); }, |
336
|
0
|
|
|
|
|
|
$directory); |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
} |
339
|
0
|
|
|
|
|
|
return; |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
####### |
345
|
|
|
|
|
|
|
# _find_test_develop_requirments |
346
|
|
|
|
|
|
|
####### |
347
|
|
|
|
|
|
|
sub _find_test_develop_requirments { |
348
|
0
|
|
|
0
|
|
|
my $self = shift; |
349
|
0
|
|
|
|
|
|
my $directorie = shift; |
350
|
0
|
|
|
|
|
|
my $filename = $_; |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
##p $directorie; |
353
|
0
|
0
|
|
|
|
|
my $phase_relationship |
354
|
|
|
|
|
|
|
= ($directorie =~ m/xt$/) ? 'DevelopRequires' : 'TestSuggests'; |
355
|
0
|
0
|
|
|
|
|
$self->_set_xtest(TRUE) if $directorie =~ m/xt$/; |
356
|
|
|
|
|
|
|
|
357
|
0
|
0
|
|
|
|
|
return if $self->is_perlfile($filename) == FALSE; |
358
|
|
|
|
|
|
|
|
359
|
0
|
|
|
|
|
|
my $relative_dir = $File::Find::dir; |
360
|
0
|
|
|
|
|
|
$relative_dir =~ s/$Working_Dir//; |
361
|
0
|
|
|
|
|
|
$self->_set_looking_infile(File::Spec->catfile($relative_dir, $filename)); |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
# Load a Document from a file and check use and require contents |
364
|
0
|
|
|
|
|
|
$self->_set_ppi_document(PPI::Document->new($filename)); |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
# don't scan xt/ for pmv |
367
|
0
|
0
|
0
|
|
|
|
$self->min_version($filename) |
368
|
|
|
|
|
|
|
if $directorie !~ m/xt$/ |
369
|
|
|
|
|
|
|
or $self->format ne 'infile'; |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
# do extra test early check for Test::Requires before hand |
373
|
0
|
|
|
|
|
|
$self->xtests_test_requires($phase_relationship); |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
# do extra test early check for use_ok in BEGIN blocks before hand |
376
|
0
|
|
|
|
|
|
$self->xtests_use_ok($phase_relationship); |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
# do extra test early to identify eval before hand |
379
|
0
|
|
|
|
|
|
$self->xtests_eval($phase_relationship); |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
# do extra test early check for use_module before hand |
382
|
0
|
|
|
|
|
|
$self->xtests_use_module($phase_relationship); |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
# let's run p-ps for the rest |
386
|
0
|
|
|
|
|
|
my $prereqs = $self->scanner->scan_ppi_document($self->ppi_document); |
387
|
0
|
|
|
|
|
|
my @modules = $prereqs->required_modules; |
388
|
|
|
|
|
|
|
|
389
|
0
|
0
|
|
|
|
|
p @modules if $self->debug; |
390
|
|
|
|
|
|
|
|
391
|
0
|
|
|
|
|
|
foreach my $mod_ver (@modules) { |
392
|
0
|
|
|
|
|
|
$self->{found_version}{$mod_ver} |
393
|
|
|
|
|
|
|
= $prereqs->requirements_for_module($mod_ver); |
394
|
|
|
|
|
|
|
} |
395
|
|
|
|
|
|
|
|
396
|
0
|
0
|
|
|
|
|
if (scalar @modules > 0) { |
397
|
0
|
|
|
|
|
|
for (0 .. $#modules) { |
398
|
|
|
|
|
|
|
|
399
|
0
|
0
|
|
|
|
|
if ($self->xtest) { |
400
|
|
|
|
|
|
|
try { |
401
|
0
|
0
|
|
0
|
|
|
$self->_process_found_modules($phase_relationship, $modules[$_], |
402
|
|
|
|
|
|
|
$prereqs->requirements_for_module($modules[$_]), |
403
|
|
|
|
|
|
|
'Perl::PrereqScanner', $phase_relationship,) |
404
|
|
|
|
|
|
|
if $self->meta2; |
405
|
0
|
|
|
|
|
|
}; |
406
|
|
|
|
|
|
|
try { |
407
|
0
|
0
|
|
0
|
|
|
$self->_process_found_modules('DevelopRequires', $modules[$_], |
408
|
|
|
|
|
|
|
$prereqs->requirements_for_module($modules[$_]), |
409
|
|
|
|
|
|
|
'Perl::PrereqScanner', 'DevelopRequires',) |
410
|
|
|
|
|
|
|
if not $self->meta2; |
411
|
0
|
|
|
|
|
|
}; |
412
|
|
|
|
|
|
|
} |
413
|
|
|
|
|
|
|
else { |
414
|
|
|
|
|
|
|
try { |
415
|
0
|
|
|
0
|
|
|
$self->_process_found_modules('TestRequires', $modules[$_], |
416
|
|
|
|
|
|
|
$prereqs->requirements_for_module($modules[$_]), |
417
|
|
|
|
|
|
|
'Perl::PrereqScanner', 'TestRequires',); |
418
|
0
|
|
|
|
|
|
}; |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
} |
421
|
|
|
|
|
|
|
} |
422
|
0
|
|
|
|
|
|
return; |
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
####### |
427
|
|
|
|
|
|
|
# composed method - _process_found_modules |
428
|
|
|
|
|
|
|
####### |
429
|
|
|
|
|
|
|
sub _process_found_modules { |
430
|
0
|
|
|
0
|
|
|
my $self = shift; |
431
|
0
|
|
|
|
|
|
my $require_type = shift; |
432
|
0
|
|
|
|
|
|
my $module = shift; |
433
|
0
|
|
0
|
|
|
|
my $version = shift || 0; |
434
|
0
|
|
0
|
|
|
|
my $extra_scanner = shift || 'none'; |
435
|
0
|
|
0
|
|
|
|
my $pr_location = shift || 'none'; |
436
|
|
|
|
|
|
|
|
437
|
0
|
0
|
|
|
|
|
p $module if $self->debug; |
438
|
0
|
0
|
|
|
|
|
p $version if $self->debug; |
439
|
0
|
0
|
|
|
|
|
p $require_type if $self->debug; |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
#deal with '' |
442
|
0
|
0
|
|
|
|
|
next if $module eq NONE; |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
# let's show every thing we can find infile |
445
|
0
|
0
|
|
|
|
|
if ($self->format ne 'infile') { |
446
|
|
|
|
|
|
|
|
447
|
0
|
|
0
|
|
|
|
my $distribution_name = $self->distribution_name || 'm/t'; |
448
|
|
|
|
|
|
|
|
449
|
0
|
0
|
|
|
|
|
if ($module =~ /perl/sxm) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
# ignore perl we will get it from minperl required |
452
|
0
|
|
|
|
|
|
next; |
453
|
|
|
|
|
|
|
} |
454
|
|
|
|
|
|
|
elsif ($module =~ /\A\Q$distribution_name\E/sxm) { |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
# don't include our own packages here |
457
|
0
|
|
|
|
|
|
next; |
458
|
|
|
|
|
|
|
} |
459
|
|
|
|
|
|
|
elsif ($module =~ /^t::/sxm) { |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
# don't include our own test packages here |
462
|
0
|
|
|
|
|
|
next; |
463
|
|
|
|
|
|
|
} |
464
|
|
|
|
|
|
|
elsif ($module =~ /^inc::Module::Install/sxm) { |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
# don't inc::Module::Install as it is really Module::Install |
467
|
0
|
|
|
|
|
|
next; |
468
|
|
|
|
|
|
|
} |
469
|
|
|
|
|
|
|
elsif ($module =~ /Mojo/sxm) { |
470
|
0
|
0
|
|
|
|
|
if ($self->experimental) { |
471
|
0
|
0
|
|
|
|
|
if ($self->_check_mojo_core($module, $require_type)) { |
472
|
0
|
0
|
|
|
|
|
if (not $self->quiet) { |
473
|
0
|
|
|
|
|
|
print BRIGHT_BLACK; |
474
|
0
|
|
|
|
|
|
print "swapping out $module for Mojolicious\n"; |
475
|
0
|
|
|
|
|
|
print CLEAR; |
476
|
|
|
|
|
|
|
} |
477
|
0
|
|
|
|
|
|
next; |
478
|
|
|
|
|
|
|
} |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
} |
481
|
|
|
|
|
|
|
elsif ($module =~ /^Padre/sxm) { |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
# mark all Padre core as just Padre only, for plugins |
484
|
0
|
|
|
|
|
|
$module = 'Padre'; |
485
|
|
|
|
|
|
|
} |
486
|
|
|
|
|
|
|
} |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
# lets keep track of how many times a module include is found |
489
|
0
|
|
|
|
|
|
$self->{modules}{$module}{count} += 1; |
490
|
|
|
|
|
|
|
try { |
491
|
0
|
|
|
0
|
|
|
push @{$self->{modules}{$module}{infiles}}, |
|
0
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
[$self->looking_infile(), $version, $extra_scanner, $pr_location,]; |
493
|
0
|
|
|
|
|
|
}; |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
# don't process already found modules |
496
|
0
|
0
|
|
|
|
|
p $self->{modules}{$module}{prereqs} if $self->debug; |
497
|
|
|
|
|
|
|
|
498
|
0
|
0
|
|
|
|
|
next if defined $self->{modules}{$module}{prereqs}; |
499
|
0
|
0
|
|
|
|
|
p $module if $self->debug; |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
# add skip for infile as we don't need to get v-string from metacpan-api |
502
|
0
|
0
|
|
|
|
|
$self->_store_modules($require_type, $module) if $self->format ne 'infile'; |
503
|
|
|
|
|
|
|
|
504
|
0
|
|
|
|
|
|
return; |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
####### |
508
|
|
|
|
|
|
|
# composed method - _store_modules |
509
|
|
|
|
|
|
|
####### |
510
|
|
|
|
|
|
|
sub _store_modules { |
511
|
0
|
|
|
0
|
|
|
my $self = shift; |
512
|
0
|
|
|
|
|
|
my $require_type = shift; |
513
|
0
|
|
|
|
|
|
my $module = shift; |
514
|
0
|
0
|
|
|
|
|
p $module if $self->debug; |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
$self->_in_corelist($module) |
517
|
0
|
0
|
|
|
|
|
if not defined $self->{modules}{$module}{corelist}; |
518
|
0
|
|
|
|
|
|
my $version = $self->get_module_version($module, $require_type); |
519
|
|
|
|
|
|
|
|
520
|
0
|
0
|
|
|
|
|
if ($version eq '!mcpan') { |
|
|
0
|
|
|
|
|
|
521
|
|
|
|
|
|
|
$self->{$require_type}{$module} = colored('!mcpan', 'magenta') |
522
|
0
|
0
|
|
|
|
|
if not $self->{skip_not_mcpan_stamp}; |
523
|
0
|
|
|
|
|
|
$self->{modules}{$module}{prereqs} = $require_type; |
524
|
0
|
|
|
|
|
|
$self->{modules}{$module}{version} = '!mcpan'; |
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
elsif ($version eq 'core') { |
527
|
0
|
0
|
|
|
|
|
$self->{$require_type}{$module} = $version if $self->core; |
528
|
0
|
0
|
|
|
|
|
$self->{$require_type}{$module} = '0' if $self->zero; |
529
|
0
|
|
|
|
|
|
$self->{modules}{$module}{prereqs} = $require_type; |
530
|
0
|
0
|
|
|
|
|
$self->{modules}{$module}{version} = $version if $self->core; |
531
|
|
|
|
|
|
|
} |
532
|
|
|
|
|
|
|
else { |
533
|
0
|
0
|
|
|
|
|
if ($self->{modules}{$module}{corelist}) { |
534
|
|
|
|
|
|
|
|
535
|
0
|
0
|
0
|
|
|
|
$self->{$require_type}{$module} = colored($version, 'bright_yellow') |
536
|
|
|
|
|
|
|
if ($self->dual_life || $self->core); |
537
|
0
|
0
|
0
|
|
|
|
$self->{modules}{$module}{prereqs} = $require_type |
538
|
|
|
|
|
|
|
if ($self->dual_life || $self->core); |
539
|
0
|
0
|
0
|
|
|
|
$self->{modules}{$module}{version} = $version |
540
|
|
|
|
|
|
|
if ($self->dual_life || $self->core); |
541
|
0
|
|
|
|
|
|
$self->{modules}{$module}{dual_life} = 1; |
542
|
0
|
|
|
|
|
|
$self->{modules}{$module}{prereqs} = $require_type; |
543
|
0
|
|
|
|
|
|
$self->{modules}{$module}{version} = $version; |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
} |
546
|
|
|
|
|
|
|
else { |
547
|
0
|
|
|
|
|
|
$self->{$require_type}{$module} = colored($version, 'yellow'); |
548
|
0
|
0
|
|
|
|
|
$self->{$require_type}{$module} |
549
|
|
|
|
|
|
|
= colored(version->parse($version)->numify, 'yellow') |
550
|
|
|
|
|
|
|
if $self->numify; |
551
|
|
|
|
|
|
|
|
552
|
0
|
|
|
|
|
|
$self->{modules}{$module}{prereqs} = $require_type; |
553
|
0
|
|
|
|
|
|
$self->{modules}{$module}{version} = $version; |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
$self->{$require_type}{$module} = colored($version, 'bright_cyan') |
556
|
0
|
0
|
|
|
|
|
if $self->{modules}{$module}{'distribution'}; |
557
|
|
|
|
|
|
|
} |
558
|
|
|
|
|
|
|
} |
559
|
0
|
0
|
|
|
|
|
p $self->{modules}{$module} if $self->debug; |
560
|
|
|
|
|
|
|
|
561
|
0
|
|
|
|
|
|
return; |
562
|
|
|
|
|
|
|
} |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
####### |
565
|
|
|
|
|
|
|
# composed method _in_corelist |
566
|
|
|
|
|
|
|
####### |
567
|
|
|
|
|
|
|
sub _in_corelist { |
568
|
0
|
|
|
0
|
|
|
my $self = shift; |
569
|
0
|
|
|
|
|
|
my $module = shift; |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
#return TRUE (1) if defined $self->{modules}{$module}{corelist}; |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
# hash with core modules to process regardless |
574
|
0
|
|
|
|
|
|
my $ignore_core = {'File::Path' => 1, 'Test::More' => 1,}; |
575
|
|
|
|
|
|
|
|
576
|
0
|
0
|
|
|
|
|
if (!$ignore_core->{$module}) { |
577
|
|
|
|
|
|
|
|
578
|
0
|
0
|
|
|
|
|
if ( Module::CoreList->first_release($module) ) { |
579
|
0
|
|
|
|
|
|
$self->{modules}{$module}{corelist} = 1; |
580
|
0
|
|
|
|
|
|
return TRUE; |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
else { |
583
|
0
|
|
|
|
|
|
$self->{modules}{$module}{corelist} = 0; |
584
|
0
|
|
|
|
|
|
return FALSE; |
585
|
|
|
|
|
|
|
} |
586
|
|
|
|
|
|
|
} |
587
|
|
|
|
|
|
|
|
588
|
0
|
|
|
|
|
|
return FALSE; |
589
|
|
|
|
|
|
|
} |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
####### |
593
|
|
|
|
|
|
|
# _check_mojo_core |
594
|
|
|
|
|
|
|
####### |
595
|
|
|
|
|
|
|
sub _check_mojo_core { |
596
|
0
|
|
|
0
|
|
|
my $self = shift; |
597
|
0
|
|
|
|
|
|
my $mojo_module = shift; |
598
|
0
|
|
|
|
|
|
my $require_type = shift; |
599
|
|
|
|
|
|
|
|
600
|
0
|
|
|
|
|
|
my $mojo_module_ver; |
601
|
0
|
|
|
|
|
|
static \my $mojo_ver; |
602
|
|
|
|
|
|
|
|
603
|
0
|
0
|
|
|
|
|
if (not defined $mojo_ver) { |
604
|
0
|
|
|
|
|
|
$mojo_ver = $self->get_module_version('Mojolicious'); |
605
|
0
|
0
|
|
|
|
|
p $mojo_ver if $self->debug; |
606
|
|
|
|
|
|
|
} |
607
|
|
|
|
|
|
|
|
608
|
0
|
|
|
|
|
|
$mojo_module_ver = $self->get_module_version($mojo_module); |
609
|
|
|
|
|
|
|
|
610
|
0
|
0
|
|
|
|
|
if ($self->verbose) { |
611
|
0
|
|
|
|
|
|
print BRIGHT_BLACK; |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
#stdout - 'looks like we found another mojo core module'; |
614
|
0
|
|
|
|
|
|
print "$mojo_module version $mojo_module_ver\n"; |
615
|
0
|
|
|
|
|
|
print CLEAR; |
616
|
|
|
|
|
|
|
} |
617
|
|
|
|
|
|
|
|
618
|
0
|
0
|
|
|
|
|
if ($mojo_ver == $mojo_module_ver) { |
619
|
|
|
|
|
|
|
$self->{$require_type}{'Mojolicious'} |
620
|
|
|
|
|
|
|
= colored($mojo_module_ver, 'bright_blue') |
621
|
0
|
0
|
|
|
|
|
if !$self->{modules}{'Mojolicious'}; |
622
|
0
|
|
|
|
|
|
$self->{modules}{'Mojolicious'}{prereqs} = $require_type; |
623
|
0
|
|
|
|
|
|
return 1; |
624
|
|
|
|
|
|
|
} |
625
|
|
|
|
|
|
|
else { |
626
|
0
|
|
|
|
|
|
return 0; |
627
|
|
|
|
|
|
|
} |
628
|
|
|
|
|
|
|
} |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
####### |
631
|
|
|
|
|
|
|
# get module version using metacpan_client (mc) |
632
|
|
|
|
|
|
|
####### |
633
|
|
|
|
|
|
|
sub get_module_version { |
634
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
635
|
0
|
|
|
|
|
|
my $module = shift; |
636
|
0
|
|
0
|
|
|
|
my $require_type = shift || undef; |
637
|
0
|
|
|
|
|
|
my $cpan_version; |
638
|
0
|
|
|
|
|
|
my $found = 0; |
639
|
0
|
|
|
|
|
|
my $mcc; |
640
|
|
|
|
|
|
|
|
641
|
0
|
0
|
|
|
|
|
p $module if $self->debug; |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
try { |
644
|
|
|
|
|
|
|
|
645
|
0
|
|
|
0
|
|
|
$mcc = $self->mcpan->module($module); |
646
|
|
|
|
|
|
|
|
647
|
0
|
|
|
|
|
|
$cpan_version = $mcc->version_numified(); |
648
|
0
|
0
|
|
|
|
|
p $cpan_version if $self->debug; |
649
|
|
|
|
|
|
|
|
650
|
0
|
|
|
|
|
|
$found = 1; |
651
|
0
|
|
|
|
|
|
}; |
652
|
|
|
|
|
|
|
try { |
653
|
0
|
|
|
0
|
|
|
my $dist_name = $mcc->distribution(); |
654
|
0
|
|
|
|
|
|
$dist_name =~ s/-/::/g; |
655
|
|
|
|
|
|
|
|
656
|
0
|
0
|
|
|
|
|
if ($dist_name eq 'perl') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
# mark all perl core modules with either 'core' or '0' |
659
|
0
|
|
|
|
|
|
$cpan_version = 'core'; |
660
|
0
|
|
|
|
|
|
$found = 1; |
661
|
|
|
|
|
|
|
} |
662
|
|
|
|
|
|
|
elsif ($module =~ m/^inc::/) { |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
#skip saving inc::Module::Install from Role-Output |
665
|
0
|
|
|
|
|
|
return $cpan_version; |
666
|
|
|
|
|
|
|
} |
667
|
|
|
|
|
|
|
elsif ($dist_name ne $module) { |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
# This is where we add a dist version to a knackered module |
670
|
0
|
|
|
|
|
|
$self->{modules}{$module}{distribution} = $dist_name; |
671
|
0
|
0
|
|
|
|
|
$self->mod_in_dist($dist_name, $module, $require_type, |
672
|
|
|
|
|
|
|
$mcc->version_numified()) |
673
|
|
|
|
|
|
|
if $require_type; |
674
|
0
|
|
|
|
|
|
$found = 1; |
675
|
|
|
|
|
|
|
} |
676
|
|
|
|
|
|
|
} |
677
|
|
|
|
|
|
|
finally { |
678
|
|
|
|
|
|
|
# not in metacpan so mark accordingly |
679
|
0
|
0
|
|
0
|
|
|
$cpan_version = '!mcpan' if $found == 0; |
680
|
0
|
|
|
|
|
|
}; |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
# the following my note be needed any more due to developments in MetaCPAN |
683
|
|
|
|
|
|
|
# scientific numbers in a version string, O what fun. |
684
|
0
|
0
|
|
|
|
|
if ($cpan_version =~ m/\d+e/) { |
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
# a bit of de crappy-flying |
687
|
|
|
|
|
|
|
# catch Test::Kwalitee::Extra 6e-06 |
688
|
0
|
|
|
|
|
|
print BRIGHT_BLACK; |
689
|
0
|
0
|
|
|
|
|
print $module |
690
|
|
|
|
|
|
|
. ' Unique Release Sequence Indicator NOT! -> ' |
691
|
|
|
|
|
|
|
. $cpan_version . "\n" |
692
|
|
|
|
|
|
|
if $self->verbose >= 1; |
693
|
0
|
|
|
|
|
|
print CLEAR; |
694
|
0
|
|
|
|
|
|
$cpan_version = version->parse($cpan_version)->numify; |
695
|
|
|
|
|
|
|
} |
696
|
|
|
|
|
|
|
|
697
|
0
|
|
|
|
|
|
return $cpan_version; |
698
|
|
|
|
|
|
|
} |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
####### |
701
|
|
|
|
|
|
|
# composed method |
702
|
|
|
|
|
|
|
####### |
703
|
|
|
|
|
|
|
sub mod_in_dist { |
704
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
705
|
0
|
|
|
|
|
|
my $dist = shift; |
706
|
0
|
|
|
|
|
|
my $module = shift; |
707
|
0
|
|
|
|
|
|
my $require_type = shift; |
708
|
0
|
|
|
|
|
|
my $version = shift; |
709
|
|
|
|
|
|
|
|
710
|
0
|
|
|
|
|
|
$dist =~ s/-/::/g; |
711
|
0
|
0
|
|
|
|
|
if ($module =~ /$dist/) { |
712
|
|
|
|
|
|
|
|
713
|
0
|
|
|
|
|
|
print BRIGHT_BLACK; |
714
|
0
|
0
|
|
|
|
|
print "module - $module -> in dist - $dist\n" if $self->verbose >= 1; |
715
|
0
|
|
|
|
|
|
print CLEAR; |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
# add dist to output hash so we can get rind of cruff later |
718
|
0
|
0
|
|
|
|
|
if ($self->experimental) { |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
$self->{$require_type}{$dist} = colored($version, 'bright_cyan') |
721
|
0
|
0
|
|
|
|
|
if not defined $self->{modules}{$module}{prereqs}; |
722
|
|
|
|
|
|
|
} |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
$self->{$require_type}{$module} = colored($version, 'bright_cyan') |
725
|
0
|
0
|
|
|
|
|
if not defined $self->{modules}{$module}{prereqs}; |
726
|
|
|
|
|
|
|
} |
727
|
|
|
|
|
|
|
|
728
|
0
|
|
|
|
|
|
return; |
729
|
|
|
|
|
|
|
} |
730
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
|
732
|
2
|
|
|
2
|
|
6559
|
no Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
17
|
|
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
1; |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
__END__ |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
=pod |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
=encoding UTF-8 |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
=head1 NAME |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
App::Midgen - Check B<RuntimeRequires> & B<TestRequires> of your package for CPAN inclusion. |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
=head1 VERSION |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
This document describes App::Midgen version: 0.33_05 |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
=head1 SYNOPSIS |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
Change to the root of your package and run |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
midgen |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
Now with a Getopt --help or -? |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
midgen -? |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
See L<midgen> for cmd line option info. |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
=head1 DESCRIPTION |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
This is an aid to show your packages module includes by scanning it's files, |
765
|
|
|
|
|
|
|
then display in a familiar format with the current version number |
766
|
|
|
|
|
|
|
from MetaCPAN. |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
This started as a way of generating the formatted contents for |
769
|
|
|
|
|
|
|
a Module::Install::DSL Makefile.PL, which has now grown to support other |
770
|
|
|
|
|
|
|
output formats, as well as the ability to show B<dual-life> and |
771
|
|
|
|
|
|
|
B<perl core> modules, see L<midgen> for option info. |
772
|
|
|
|
|
|
|
This enables you to see which modules you have used, we even try and list Dist-Zilla Plugins. |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
All output goes to STDOUT, so you can use it as you see fit. |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
B<MetaCPAN Version Number Displayed> |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=over 4 |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=item * NN.nnnnnn we got the current version number from MetaCPAN. |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
=item * 'core' indicates the module is a perl core module. |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
=item * '!mcpan' must be local, one of yours. Not in MetaCPAN, Not in core. |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
=back |
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
I<Food for thought, if we update our Modules, |
789
|
|
|
|
|
|
|
don't we want our users to use the current version, |
790
|
|
|
|
|
|
|
so should we not by default do the same with others Modules. |
791
|
|
|
|
|
|
|
Thus we always show the current version number, regardless.> |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
We also display some other complementary information relevant to this package |
794
|
|
|
|
|
|
|
and your chosen output format. |
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
For more info and sample output see L<wiki|https://github.com/kevindawson/App-Midgen/wiki> |
797
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
=head1 METHODS |
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
=over 4 |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
=item * find_runtime_modules |
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
Search for C<Prereqs RuntimeRecommends> and C<Prereqs RuntimeRequires> in |
805
|
|
|
|
|
|
|
package modules C<script\>, C<bin\>, C<lib\>, C<share\> with B<UseModule> |
806
|
|
|
|
|
|
|
and B<Eval> followed by B<PPS>. |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
=item * find_test_modules |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
Search for C<Prereqs TestSuggests> and C<Prereqs TestRequire> in B<t\> scripts, |
811
|
|
|
|
|
|
|
with B<UseOk> and B<TestRequires> followed by B<PPS>. |
812
|
|
|
|
|
|
|
|
813
|
|
|
|
|
|
|
=item * find_develop_modules |
814
|
|
|
|
|
|
|
|
815
|
|
|
|
|
|
|
Search for C<Prereqs DevelopRequire> in C<xt\> using all available scanners. |
816
|
|
|
|
|
|
|
|
817
|
|
|
|
|
|
|
=item * first_package_name |
818
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
Assume first package found is your packages name |
820
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
=item * get_module_version |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
side affect of re-factoring, helps with code readability |
824
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
=item * mod_in_dist |
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
Check if module is in a distribution and use that version number, rather than 'undef' |
828
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
=item * run |
830
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
=back |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
App::Midgen requires no configuration files or environment variables. |
836
|
|
|
|
|
|
|
We do honour $ENV{ANSI_COLORS_DISABLED} |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
L<App::Midgen::Roles>, L<App::Midgen::Output> |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
843
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
After some reflection, we do not scan xt/... |
845
|
|
|
|
|
|
|
as the methods by which the modules are Included are various, |
846
|
|
|
|
|
|
|
this is best left to the module Author. |
847
|
|
|
|
|
|
|
|
848
|
|
|
|
|
|
|
=head1 WARNINGS |
849
|
|
|
|
|
|
|
|
850
|
|
|
|
|
|
|
As our mantra is to show the current version of a module, |
851
|
|
|
|
|
|
|
we do this by asking MetaCPAN directly so we are going to need to |
852
|
|
|
|
|
|
|
connect to L<http://api.metacpan.org/v0/>. |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
There may be some modules on CPAN that when MetaCPAN-API asks for there |
857
|
|
|
|
|
|
|
version string, it is provided with the wrong information, as the contents |
858
|
|
|
|
|
|
|
of there Meta files are out of sync with there current version string. |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
861
|
|
|
|
|
|
|
through the web interface at |
862
|
|
|
|
|
|
|
L<https://github.com/kevindawson/App-Midgen/issues>. |
863
|
|
|
|
|
|
|
If reporting a Bug, also supply the Module info, midgen failed against. |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
=head1 AUTHOR |
866
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
Kevin Dawson E<lt>bowtie@cpan.orgE<gt> |
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
=head2 CONTRIBUTORS |
870
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
Ahmad M. Zawawi E<lt>ahmad.zawawi@gmail.comE<gt> |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
Matt S. Trout E<lt>mst@shadowcat.co.ukE<gt> |
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
Tommy Butler E<lt>ace@tommybutler.meE<gt> |
876
|
|
|
|
|
|
|
|
877
|
|
|
|
|
|
|
Neil Bowers E<lt>neilb@cpan.orgE<gt> |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt> |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt> |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
Karen Etheridge E<lt>ether@cpan.orgE<gt> |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
Oliver Gorwits E<lt>oliver@cpan.orgE<gt> |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
=head1 COPYRIGHT |
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
Copyright E<copy> 2013-2014 the App:Midgen L</AUTHOR> and L</CONTRIBUTORS> |
890
|
|
|
|
|
|
|
as listed above. |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
=head1 LICENSE |
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
896
|
|
|
|
|
|
|
it under the same terms as Perl 5 itself. |
897
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
=head1 SEE ALSO |
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
L<Perl::PrereqScanner>, |
901
|
|
|
|
|
|
|
L<inc::Module::Install::DSL> |
902
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
904
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
906
|
|
|
|
|
|
|
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
907
|
|
|
|
|
|
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
908
|
|
|
|
|
|
|
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
909
|
|
|
|
|
|
|
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
910
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE |
911
|
|
|
|
|
|
|
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH |
912
|
|
|
|
|
|
|
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL |
913
|
|
|
|
|
|
|
NECESSARY SERVICING, REPAIR, OR CORRECTION. |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
916
|
|
|
|
|
|
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
917
|
|
|
|
|
|
|
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE |
918
|
|
|
|
|
|
|
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, |
919
|
|
|
|
|
|
|
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE |
920
|
|
|
|
|
|
|
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
921
|
|
|
|
|
|
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
922
|
|
|
|
|
|
|
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
923
|
|
|
|
|
|
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
924
|
|
|
|
|
|
|
SUCH DAMAGES. |
925
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
=cut |