line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::NotQuiteLite::Util::Prereqs; |
2
|
|
|
|
|
|
|
|
3
|
58
|
|
|
58
|
|
71112
|
use strict; |
|
58
|
|
|
|
|
100
|
|
|
58
|
|
|
|
|
1350
|
|
4
|
58
|
|
|
58
|
|
232
|
use warnings; |
|
58
|
|
|
|
|
97
|
|
|
58
|
|
|
|
|
1418
|
|
5
|
58
|
|
|
58
|
|
231
|
use Exporter 5.57 'import'; |
|
58
|
|
|
|
|
882
|
|
|
58
|
|
|
|
|
20271
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT = qw/dedupe_prereqs_and_features/; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub dedupe_prereqs_and_features { |
10
|
58
|
|
|
58
|
0
|
127
|
my ($prereqs, $features) = @_; |
11
|
|
|
|
|
|
|
|
12
|
58
|
|
|
|
|
163
|
my @valid_features = grep defined, values %$features; |
13
|
58
|
|
|
|
|
179
|
for my $phase ($prereqs->phases) { |
14
|
185
|
|
|
|
|
1470
|
my $requires = $prereqs->requirements_for($phase, 'requires'); |
15
|
185
|
|
|
|
|
3980
|
for my $type (qw/recommends suggests/) { |
16
|
370
|
|
|
|
|
574
|
my $target = $prereqs->requirements_for($phase, $type); |
17
|
370
|
|
|
|
|
7980
|
_dedupe($requires, $target); |
18
|
|
|
|
|
|
|
} |
19
|
185
|
|
|
|
|
297
|
for my $feature (@valid_features) { |
20
|
50
|
|
|
|
|
75
|
for my $type (qw/requires recommends suggests/) { |
21
|
150
|
|
|
|
|
276
|
my $target = $feature->requirements_for($phase, $type); |
22
|
150
|
|
|
|
|
3267
|
_dedupe($requires, $target); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
185
|
|
|
|
|
318
|
my $recommends = $prereqs->requirements_for($phase, 'recommends'); |
26
|
185
|
|
|
|
|
3838
|
for my $type (qw/suggests/) { |
27
|
185
|
|
|
|
|
290
|
my $target = $prereqs->requirements_for($phase, $type); |
28
|
185
|
|
|
|
|
3834
|
_dedupe($recommends, $target); |
29
|
|
|
|
|
|
|
} |
30
|
185
|
|
|
|
|
277
|
for my $feature (@valid_features) { |
31
|
50
|
|
|
|
|
73
|
for my $type (qw/recommends suggests/) { |
32
|
100
|
|
|
|
|
158
|
my $target = $feature->requirements_for($phase, $type); |
33
|
100
|
|
|
|
|
2119
|
_dedupe($recommends, $target); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
185
|
|
|
|
|
295
|
my $suggests = $prereqs->requirements_for($phase, 'suggests'); |
37
|
185
|
|
|
|
|
3989
|
for my $feature (@valid_features) { |
38
|
50
|
|
|
|
|
82
|
for my $type (qw/suggests/) { |
39
|
50
|
|
|
|
|
79
|
my $target = $feature->requirements_for($phase, $type); |
40
|
50
|
|
|
|
|
1008
|
_dedupe($suggests, $target); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _dedupe { |
47
|
855
|
|
|
855
|
|
1133
|
my ($source, $target) = @_; |
48
|
855
|
|
|
|
|
1320
|
my @modules = $source->required_modules; |
49
|
855
|
|
|
|
|
3344
|
for my $module (@modules) { |
50
|
344
|
|
|
|
|
649
|
my $version = $target->requirements_for_module($module); |
51
|
344
|
100
|
|
|
|
2634
|
next unless defined $version; |
52
|
21
|
50
|
|
|
|
85
|
next unless $version =~ /^[0-9._]+$/; |
53
|
21
|
50
|
|
|
|
56
|
next unless $source->accepts_module($module, $version); |
54
|
21
|
|
|
|
|
529
|
$target->clear_requirement($module); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |