line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::CPANfile::Prereqs; |
2
|
7
|
|
|
7
|
|
46
|
use strict; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
181
|
|
3
|
7
|
|
|
7
|
|
38
|
use Carp (); |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
170
|
|
4
|
7
|
|
|
7
|
|
3345
|
use CPAN::Meta::Feature; |
|
7
|
|
|
|
|
78744
|
|
|
7
|
|
|
|
|
316
|
|
5
|
7
|
|
|
7
|
|
3839
|
use Module::CPANfile::Prereq; |
|
7
|
|
|
|
|
24
|
|
|
7
|
|
|
|
|
5490
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub from_cpan_meta { |
8
|
1
|
|
|
1
|
0
|
4
|
my($class, $prereqs) = @_; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
|
|
4
|
my $self = $class->new; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
|
|
5
|
for my $phase (keys %$prereqs) { |
13
|
2
|
|
|
|
|
21
|
for my $type (keys %{ $prereqs->{$phase} }) { |
|
2
|
|
|
|
|
29
|
|
14
|
2
|
|
|
|
|
7
|
while (my($module, $requirement) = each %{ $prereqs->{$phase}{$type} }) { |
|
6
|
|
|
|
|
34
|
|
15
|
4
|
|
|
|
|
26
|
$self->add( |
16
|
|
|
|
|
|
|
phase => $phase, |
17
|
|
|
|
|
|
|
type => $type, |
18
|
|
|
|
|
|
|
module => $module, |
19
|
|
|
|
|
|
|
requirement => Module::CPANfile::Requirement->new(name => $module, version => $requirement), |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
5
|
$self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
15
|
|
|
15
|
0
|
39
|
my $class = shift; |
30
|
15
|
|
|
|
|
173
|
bless { |
31
|
|
|
|
|
|
|
prereqs => {}, |
32
|
|
|
|
|
|
|
features => {}, |
33
|
|
|
|
|
|
|
}, $class; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub add_feature { |
37
|
2
|
|
|
2
|
0
|
5
|
my($self, $identifier, $description) = @_; |
38
|
2
|
|
|
|
|
10
|
$self->{features}{$identifier} = { description => $description }; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub add { |
42
|
39
|
|
|
39
|
0
|
177
|
my($self, %args) = @_; |
43
|
|
|
|
|
|
|
|
44
|
39
|
|
100
|
|
|
173
|
my $feature = $args{feature} || ''; |
45
|
39
|
|
|
|
|
82
|
push @{$self->{prereqs}{$feature}}, |
|
39
|
|
|
|
|
296
|
|
46
|
|
|
|
|
|
|
Module::CPANfile::Prereq->new(%args); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub as_cpan_meta { |
50
|
23
|
|
|
23
|
0
|
88
|
my $self = shift; |
51
|
23
|
|
66
|
|
|
153
|
$self->{cpanmeta} ||= $self->build_cpan_meta; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub build_cpan_meta { |
55
|
17
|
|
|
17
|
0
|
68
|
my($self, $feature) = @_; |
56
|
17
|
|
|
|
|
74
|
CPAN::Meta::Prereqs->new($self->specs($feature)); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub specs { |
60
|
17
|
|
|
17
|
0
|
48
|
my($self, $feature) = @_; |
61
|
|
|
|
|
|
|
|
62
|
17
|
100
|
|
|
|
57
|
$feature = '' |
63
|
|
|
|
|
|
|
unless defined $feature; |
64
|
|
|
|
|
|
|
|
65
|
17
|
|
50
|
|
|
68
|
my $prereqs = $self->{prereqs}{$feature} || []; |
66
|
17
|
|
|
|
|
40
|
my $specs = {}; |
67
|
|
|
|
|
|
|
|
68
|
17
|
|
|
|
|
50
|
for my $prereq (@$prereqs) { |
69
|
38
|
|
|
|
|
127
|
$specs->{$prereq->phase}{$prereq->type}{$prereq->module} = |
70
|
|
|
|
|
|
|
$prereq->requirement->version; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
17
|
|
|
|
|
151
|
return $specs; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub merged_requirements { |
77
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
0
|
my $reqs = CPAN::Meta::Requirements->new; |
80
|
0
|
|
|
|
|
0
|
for my $prereq (@{$self->{prereqs}}) { |
|
0
|
|
|
|
|
0
|
|
81
|
0
|
|
|
|
|
0
|
$reqs->add_string_requirement($prereq->module, $prereq->requirement->version); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
0
|
$reqs; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub find { |
88
|
38
|
|
|
38
|
0
|
86
|
my($self, $module) = @_; |
89
|
|
|
|
|
|
|
|
90
|
38
|
|
|
|
|
64
|
for my $feature ('', keys %{$self->{features}}) { |
|
38
|
|
|
|
|
138
|
|
91
|
40
|
|
|
|
|
68
|
for my $prereq (@{$self->{prereqs}{$feature}}) { |
|
40
|
|
|
|
|
101
|
|
92
|
82
|
100
|
|
|
|
217
|
return $prereq if $prereq->module eq $module; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
0
|
return; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub identifiers { |
100
|
10
|
|
|
10
|
0
|
23
|
my $self = shift; |
101
|
10
|
|
|
|
|
20
|
keys %{$self->{features}}; |
|
10
|
|
|
|
|
52
|
|
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub feature { |
105
|
7
|
|
|
7
|
0
|
18
|
my($self, $identifier) = @_; |
106
|
|
|
|
|
|
|
|
107
|
7
|
100
|
|
|
|
219
|
my $data = $self->{features}{$identifier} |
108
|
|
|
|
|
|
|
or Carp::croak("Unknown feature '$identifier'"); |
109
|
|
|
|
|
|
|
|
110
|
6
|
|
|
|
|
19
|
my $prereqs = $self->build_cpan_meta($identifier); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
CPAN::Meta::Feature->new($identifier, { |
113
|
|
|
|
|
|
|
description => $data->{description}, |
114
|
6
|
|
|
|
|
1249
|
prereqs => $prereqs->as_string_hash, |
115
|
|
|
|
|
|
|
}); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; |