line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
27000
|
use 5.006; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
67
|
|
2
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
54
|
|
3
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
137
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package CPAN::Distribution::ReleaseHistory; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.002003'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Show the release history of a single distribution |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
1066
|
use Moo 1.000008 qw( has ); |
|
2
|
|
|
|
|
22469
|
|
|
2
|
|
|
|
|
10
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has 'distribution' => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
required => 1, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has 'sort' => ( |
68
|
|
|
|
|
|
|
is => 'ro', |
69
|
|
|
|
|
|
|
lazy => 1, |
70
|
0
|
|
|
0
|
|
0
|
builder => sub { 'desc' }, |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
has 'scroll_size' => ( |
87
|
|
|
|
|
|
|
is => 'ro', |
88
|
|
|
|
|
|
|
lazy => 1, |
89
|
1
|
|
|
1
|
|
399
|
builder => sub { 1000 }, |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _iterator_from_scroll { |
104
|
1
|
|
|
1
|
|
219370
|
my ( undef, $scroll ) = @_; |
105
|
1
|
|
|
|
|
655
|
require CPAN::Distribution::ReleaseHistory::ReleaseIterator; |
106
|
1
|
|
|
|
|
6
|
return CPAN::Distribution::ReleaseHistory::ReleaseIterator->new( scroller => $scroll ); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub release_iterator { |
110
|
1
|
|
|
1
|
1
|
1745
|
my ($self) = @_; |
111
|
1
|
|
|
|
|
4
|
return $self->_iterator_from_scroll( $self->_mk_query_distribution ); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
has 'ua' => ( |
127
|
|
|
|
|
|
|
is => 'ro', |
128
|
|
|
|
|
|
|
predicate => 'has_ua', |
129
|
|
|
|
|
|
|
); |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
has 'es' => ( |
138
|
|
|
|
|
|
|
is => 'ro', |
139
|
|
|
|
|
|
|
lazy => 1, |
140
|
|
|
|
|
|
|
builder => sub { |
141
|
1
|
|
|
1
|
|
368
|
my ($self) = @_; |
142
|
1
|
|
|
|
|
6
|
my %args = ( |
143
|
|
|
|
|
|
|
nodes => 'api.metacpan.org', |
144
|
|
|
|
|
|
|
cxn_pool => 'Static::NoPing', |
145
|
|
|
|
|
|
|
send_get_body_as => 'POST', |
146
|
|
|
|
|
|
|
); |
147
|
1
|
50
|
|
|
|
9
|
if ( $self->has_ua ) { |
148
|
0
|
|
|
|
|
0
|
$args{handle} = $self->ua; |
149
|
|
|
|
|
|
|
} |
150
|
1
|
|
|
|
|
472
|
require Search::Elasticsearch; |
151
|
1
|
|
|
|
|
1281
|
return Search::Elasticsearch->new(%args); |
152
|
|
|
|
|
|
|
}, |
153
|
|
|
|
|
|
|
); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub _mk_query { |
156
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
157
|
1
|
|
|
|
|
7
|
return { term => { distribution => $self->distribution } }; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub _mk_body { |
161
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
162
|
1
|
|
|
|
|
4
|
my $body = { query => $self->_mk_query }; |
163
|
1
|
50
|
|
|
|
4
|
if ( $self->sort ) { |
164
|
1
|
|
|
|
|
424
|
$body->{sort} = { 'stat.mtime' => $self->sort }; |
165
|
|
|
|
|
|
|
} |
166
|
1
|
|
|
|
|
10
|
return $body; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub _mk_fields { |
170
|
1
|
|
|
1
|
|
7
|
return [qw(name version date status maturity stat download_url )]; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub _mk_scroll_args { |
174
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
175
|
1
|
|
|
|
|
4
|
my %scrollargs = ( |
176
|
|
|
|
|
|
|
scroll => '5m', |
177
|
|
|
|
|
|
|
index => 'v0', |
178
|
|
|
|
|
|
|
type => 'release', |
179
|
|
|
|
|
|
|
size => $self->scroll_size, |
180
|
|
|
|
|
|
|
body => $self->_mk_body, |
181
|
|
|
|
|
|
|
fields => $self->_mk_fields, |
182
|
|
|
|
|
|
|
); |
183
|
|
|
|
|
|
|
|
184
|
1
|
50
|
|
|
|
16
|
if ( not $self->sort ) { |
185
|
0
|
|
|
|
|
0
|
$scrollargs{'search_type'} = 'scan'; |
186
|
|
|
|
|
|
|
} |
187
|
1
|
|
|
|
|
10
|
return \%scrollargs; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub _mk_query_distribution { |
191
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
192
|
|
|
|
|
|
|
|
193
|
1
|
|
|
|
|
1
|
my %scrollargs = %{ $self->_mk_scroll_args }; |
|
1
|
|
|
|
|
4
|
|
194
|
|
|
|
|
|
|
|
195
|
1
|
|
|
|
|
577
|
require Search::Elasticsearch::Scroll; |
196
|
|
|
|
|
|
|
|
197
|
1
|
|
|
|
|
44414
|
return $self->es->scroll_helper(%scrollargs); |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
2
|
|
|
2
|
|
3068
|
no Moo; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
7
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
1; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
__END__ |