| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Module::cpmfile v1.0.0; |
|
2
|
3
|
|
|
3
|
|
729259
|
use v5.24; |
|
|
3
|
|
|
|
|
12
|
|
|
3
|
3
|
|
|
3
|
|
25
|
use warnings; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
244
|
|
|
4
|
3
|
|
|
3
|
|
22
|
use experimental qw(lexical_subs signatures); |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
28
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $TRIAL = 0; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
2438
|
use Module::cpmfile::Prereqs; |
|
|
3
|
|
|
|
|
13
|
|
|
|
3
|
|
|
|
|
183
|
|
|
10
|
3
|
|
|
3
|
|
22
|
use Module::cpmfile::Util qw(merge_version _yaml_hash); |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
165
|
|
|
11
|
3
|
|
|
3
|
|
2029
|
use YAML::PP (); |
|
|
3
|
|
|
|
|
209052
|
|
|
|
3
|
|
|
|
|
5071
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
0
|
417662
|
sub load ($class, $file) { |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
4
|
|
|
14
|
2
|
|
|
|
|
17
|
my ($hash) = YAML::PP->new->load_file($file); |
|
15
|
2
|
|
|
|
|
68530
|
$class->new($hash); |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
0
|
12
|
sub new ($class, $hash) { |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
8
|
|
|
19
|
2
|
|
|
|
|
31
|
my $prereqs = Module::cpmfile::Prereqs->new($hash->{prereqs}); |
|
20
|
2
|
|
|
|
|
4
|
my %feature; |
|
21
|
2
|
50
|
|
|
|
5
|
for my $id (sort keys %{ $hash->{features} || +{} }) { |
|
|
2
|
|
|
|
|
87
|
|
|
22
|
4
|
|
|
|
|
14
|
my $description = $hash->{features}{$id}{description}; |
|
23
|
4
|
|
|
|
|
16
|
my $prereqs = Module::cpmfile::Prereqs->new($hash->{features}{$id}{prereqs}); |
|
24
|
4
|
|
|
|
|
22
|
$feature{$id} = { description => $description, prereqs => $prereqs }; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
2
|
|
|
|
|
31
|
bless { prereqs => $prereqs, features => \%feature, _mirrors => [] }, $class; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
0
|
162958
|
sub from_cpanfile ($class, $cpanfile) { |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
2
|
|
|
30
|
1
|
|
|
|
|
2
|
my %feature; |
|
31
|
1
|
|
|
|
|
3
|
for my $feature ($cpanfile->features) { |
|
32
|
1
|
|
|
|
|
473
|
my $id = $feature->{identifier}; |
|
33
|
1
|
|
|
|
|
1
|
my $description = $feature->{description}; |
|
34
|
1
|
|
|
|
|
9
|
my $prereqs = Module::cpmfile::Prereqs->from_cpanmeta($feature->{prereqs}); |
|
35
|
1
|
|
|
|
|
4
|
$feature{$id} = { description => $description, prereqs => $prereqs }; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
1
|
|
|
|
|
9
|
my $prereqs = Module::cpmfile::Prereqs->from_cpanmeta($cpanfile->prereqs); |
|
38
|
1
|
|
|
|
|
3
|
for my $p ($prereqs, map { $_->{prereqs} } values %feature) { |
|
|
1
|
|
|
|
|
4
|
|
|
39
|
6
|
|
|
6
|
|
5
|
$p->walk(undef, undef, sub ($phase, $type, $package, $original_options) { |
|
|
6
|
|
|
|
|
6
|
|
|
|
6
|
|
|
|
|
7
|
|
|
|
6
|
|
|
|
|
5
|
|
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
5
|
|
|
40
|
6
|
|
50
|
|
|
10
|
my $additional_options = $cpanfile->options_for_module($package) || +{}; |
|
41
|
6
|
100
|
|
|
|
167
|
if ($additional_options->%*) { |
|
42
|
1
|
|
|
|
|
19
|
$original_options->%* = ($original_options->%*, $additional_options->%*); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
2
|
|
|
|
|
18
|
}); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
1
|
|
|
|
|
4
|
my $mirrors = $cpanfile->mirrors; |
|
47
|
1
|
|
|
|
|
10
|
bless { prereqs => $prereqs, features => \%feature, _mirrors => $mirrors }, $class; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
0
|
0
|
sub from_cpanmeta ($class, $cpanmeta) { |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
51
|
0
|
|
|
|
|
0
|
my %feature; |
|
52
|
0
|
|
|
|
|
0
|
for my $id (keys %{$cpanmeta->optional_features}) { |
|
|
0
|
|
|
|
|
0
|
|
|
53
|
0
|
|
|
|
|
0
|
my $f = $cpanmeta->optional_features->{$id}; |
|
54
|
0
|
|
|
|
|
0
|
my $description = $f->{description}; |
|
55
|
0
|
|
|
|
|
0
|
my $prereqs = Module::cpmfile::Prereqs->from_cpanmeta($f->{prereqs}); |
|
56
|
0
|
|
|
|
|
0
|
$feature{$id} = { description => $description, prereqs => $prereqs }; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
0
|
|
|
|
|
0
|
my $prereqs = Module::cpmfile::Prereqs->from_cpanmeta($cpanmeta->prereqs); |
|
59
|
0
|
|
|
|
|
0
|
bless { prereqs => $prereqs, features => \%feature, _mirrors => [] }, $class; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
1
|
|
|
1
|
0
|
3
|
sub prereqs ($self) { |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1
|
|
|
63
|
1
|
|
|
|
|
13
|
$self->{prereqs}; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
2
|
|
|
2
|
0
|
5802
|
sub features ($self) { |
|
|
2
|
|
|
|
|
27
|
|
|
|
2
|
|
|
|
|
4
|
|
|
67
|
2
|
50
|
|
|
|
12
|
if ($self->{features}->%*) { |
|
68
|
2
|
|
|
|
|
15
|
return $self->{features}; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
0
|
|
|
|
|
0
|
return; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
3
|
|
|
3
|
|
5
|
sub _feature_prereqs ($self, $ids = undef) { |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
5
|
|
|
74
|
3
|
|
|
|
|
6
|
my @prereqs; |
|
75
|
3
|
100
|
|
|
|
5
|
for my $id (@{ $ids || [] }) { |
|
|
3
|
|
|
|
|
39
|
|
|
76
|
1
|
|
|
|
|
34
|
my $feature = $self->{features}{$id}; |
|
77
|
1
|
50
|
33
|
|
|
9
|
next if !$feature || !$feature->{prereqs}; |
|
78
|
|
|
|
|
|
|
push @prereqs, $feature->{prereqs} |
|
79
|
1
|
|
|
|
|
3
|
} |
|
80
|
3
|
|
|
|
|
9
|
@prereqs; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
3
|
|
|
3
|
0
|
10852
|
sub effective_requirements ($self, $feature_ids = undef, $phases = undef, $types = undef) { |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
5
|
|
|
84
|
3
|
|
|
|
|
5
|
my %req; |
|
85
|
3
|
|
|
|
|
17
|
for my $prereqs ($self->{prereqs}, $self->_feature_prereqs($feature_ids)) { |
|
86
|
13
|
|
|
13
|
|
16
|
$prereqs->walk($phases, $types, sub ($phase, $type, $package, $options) { |
|
|
13
|
|
|
|
|
19
|
|
|
|
13
|
|
|
|
|
15
|
|
|
|
13
|
|
|
|
|
30
|
|
|
|
13
|
|
|
|
|
16
|
|
|
|
13
|
|
|
|
|
17
|
|
|
87
|
13
|
100
|
|
|
|
23
|
if (exists $req{$package}) { |
|
88
|
1
|
|
50
|
|
|
4
|
my $v1 = $req{$package}{version} || 0; |
|
89
|
1
|
|
50
|
|
|
4
|
my $v2 = $options->{version} || 0; |
|
90
|
1
|
|
|
|
|
5
|
my $version = merge_version $v1, $v2; |
|
91
|
|
|
|
|
|
|
$req{$package} = +{ |
|
92
|
1
|
50
|
|
|
|
84
|
%{$req{$package}}, |
|
|
1
|
|
|
|
|
13
|
|
|
93
|
|
|
|
|
|
|
$options->%*, |
|
94
|
|
|
|
|
|
|
$version ? (version => $version) : (), |
|
95
|
|
|
|
|
|
|
}; |
|
96
|
|
|
|
|
|
|
} else { |
|
97
|
12
|
|
|
|
|
65
|
$req{$package} = $options; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
4
|
|
|
|
|
33
|
}); |
|
100
|
|
|
|
|
|
|
} |
|
101
|
3
|
|
|
|
|
13
|
\%req; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
1
|
|
|
1
|
0
|
7
|
sub to_string ($self) { |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
3
|
|
|
105
|
1
|
|
|
|
|
2
|
my @out; |
|
106
|
1
|
|
|
|
|
4
|
push @out, $self->prereqs->to_string; |
|
107
|
1
|
50
|
|
|
|
5
|
if (my $features = $self->features) { |
|
108
|
1
|
|
|
|
|
4
|
push @out, "features:"; |
|
109
|
1
|
|
|
|
|
6
|
for my $id (sort keys $features->%*) { |
|
110
|
2
|
|
|
|
|
3
|
my $feature = $features->{$id}; |
|
111
|
2
|
|
|
|
|
8
|
push @out, " $id:"; |
|
112
|
2
|
50
|
|
|
|
8
|
if (my $desc = $feature->{description}) { |
|
113
|
2
|
|
|
|
|
8
|
push @out, _yaml_hash({ description => $desc }, " "); |
|
114
|
|
|
|
|
|
|
} |
|
115
|
2
|
50
|
|
|
|
8
|
if (my $prereqs = $feature->{prereqs}) { |
|
116
|
2
|
|
|
|
|
7
|
push @out, $prereqs->to_string(" "); |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
} |
|
120
|
1
|
|
|
|
|
8
|
( join "\n", @out ) . "\n"; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
1; |
|
124
|
|
|
|
|
|
|
__END__ |