line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
39912
|
use 5.006; |
|
2
|
|
|
|
|
6
|
|
2
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
44
|
|
3
|
2
|
|
|
2
|
|
21
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
168
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package CPAN::Distribution::ReleaseHistory; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.002004'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Show the release history of a single distribution |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
1213
|
use Moo 1.000008 qw( has ); |
|
2
|
|
|
|
|
24412
|
|
|
2
|
|
|
|
|
11
|
|
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
|
|
705
|
builder => sub { 1000 }, |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _iterator_from_scroll { |
104
|
1
|
|
|
1
|
|
115044
|
my ( undef, $scroll ) = @_; |
105
|
1
|
|
|
|
|
982
|
require CPAN::Distribution::ReleaseHistory::ReleaseIterator; |
106
|
1
|
|
|
|
|
7
|
return CPAN::Distribution::ReleaseHistory::ReleaseIterator->new( scroller => $scroll ); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub release_iterator { |
110
|
1
|
|
|
1
|
1
|
3112
|
my ($self) = @_; |
111
|
1
|
|
|
|
|
7
|
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
|
|
529
|
my ($self) = @_; |
142
|
1
|
|
|
|
|
5
|
my %args = ( |
143
|
|
|
|
|
|
|
nodes => 'api.metacpan.org', |
144
|
|
|
|
|
|
|
cxn_pool => 'Static::NoPing', |
145
|
|
|
|
|
|
|
send_get_body_as => 'POST', |
146
|
|
|
|
|
|
|
); |
147
|
1
|
50
|
|
|
|
6
|
if ( $self->has_ua ) { |
148
|
0
|
|
|
|
|
0
|
$args{handle} = $self->ua; |
149
|
|
|
|
|
|
|
} |
150
|
1
|
|
|
|
|
1579
|
require Search::Elasticsearch; |
151
|
1
|
|
|
|
|
39908
|
return Search::Elasticsearch->new(%args); |
152
|
|
|
|
|
|
|
}, |
153
|
|
|
|
|
|
|
); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub _mk_query { |
156
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
157
|
1
|
|
|
|
|
11
|
return { term => { distribution => $self->distribution } }; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub _mk_body { |
161
|
1
|
|
|
1
|
|
3
|
my ($self) = @_; |
162
|
1
|
|
|
|
|
6
|
my $body = { query => $self->_mk_query }; |
163
|
1
|
50
|
|
|
|
6
|
if ( $self->sort ) { |
164
|
1
|
|
|
|
|
625
|
$body->{sort} = { 'stat.mtime' => $self->sort }; |
165
|
|
|
|
|
|
|
} |
166
|
1
|
|
|
|
|
21
|
return $body; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub _mk_fields { |
170
|
1
|
|
|
1
|
|
336635
|
return [qw(name version date status maturity stat download_url )]; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub _es_version { |
174
|
2
|
|
|
2
|
|
7
|
my ( $self, $wanted_version ) = @_; |
175
|
2
|
|
|
|
|
6
|
local $@ = undef; |
176
|
2
|
|
|
|
|
6
|
return eval { $self->es->VERSION($wanted_version); 1 }; ## no critic (RequireCheckingReturnValueOfEval) |
|
2
|
|
|
|
|
42
|
|
|
0
|
|
|
|
|
0
|
|
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub _mk_scroll_args { |
180
|
1
|
|
|
1
|
|
3
|
my ($self) = @_; |
181
|
|
|
|
|
|
|
|
182
|
1
|
50
|
|
|
|
8
|
my %scrollargs = ( |
183
|
|
|
|
|
|
|
scroll => '5m', |
184
|
|
|
|
|
|
|
index => 'v0', |
185
|
|
|
|
|
|
|
type => 'release', |
186
|
|
|
|
|
|
|
size => $self->scroll_size, |
187
|
|
|
|
|
|
|
body => $self->_mk_body, |
188
|
|
|
|
|
|
|
( $self->_es_version(5) ? 'stored_fields' : 'fields' ) => $self->_mk_fields, |
189
|
|
|
|
|
|
|
); |
190
|
|
|
|
|
|
|
|
191
|
1
|
50
|
|
|
|
43
|
if ( not $self->sort ) { |
192
|
0
|
|
|
|
|
0
|
$scrollargs{'search_type'} = 'scan'; |
193
|
|
|
|
|
|
|
} |
194
|
1
|
|
|
|
|
29
|
return \%scrollargs; |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub _mk_query_distribution { |
198
|
1
|
|
|
1
|
|
3
|
my ($self) = @_; |
199
|
|
|
|
|
|
|
|
200
|
1
|
|
|
|
|
2
|
my %scrollargs = %{ $self->_mk_scroll_args }; |
|
1
|
|
|
|
|
5
|
|
201
|
|
|
|
|
|
|
|
202
|
1
|
50
|
|
|
|
8
|
( $self->_es_version(5) ) |
203
|
|
|
|
|
|
|
? ( require Search::Elasticsearch::Client::5_0::Scroll ) |
204
|
|
|
|
|
|
|
: ( require Search::Elasticsearch::Scroll ); |
205
|
|
|
|
|
|
|
|
206
|
1
|
|
|
|
|
15252
|
return $self->es->scroll_helper(%scrollargs); |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
2
|
|
|
2
|
|
3421
|
no Moo; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
1; |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
__END__ |