line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
58604
|
use 5.006; |
|
2
|
|
|
|
|
5
|
|
2
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
52
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
178
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package CPAN::Distribution::ReleaseHistory; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.002005'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Show the release history of a single distribution |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
1300
|
use Moo 1.000008 qw( has ); |
|
2
|
|
|
|
|
29135
|
|
|
2
|
|
|
|
|
12
|
|
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
|
|
11
|
builder => sub { 1000 }, |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _iterator_from_scroll { |
104
|
1
|
|
|
1
|
|
265468
|
my ( undef, $scroll ) = @_; |
105
|
1
|
|
|
|
|
803
|
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
|
1887
|
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
|
|
7
|
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
|
|
|
|
4
|
if ( $self->has_ua ) { |
148
|
0
|
|
|
|
|
0
|
$args{handle} = $self->ua; |
149
|
|
|
|
|
|
|
} |
150
|
1
|
|
|
|
|
437
|
require Search::Elasticsearch; |
151
|
1
|
|
|
|
|
31986
|
return Search::Elasticsearch->new(%args); |
152
|
|
|
|
|
|
|
}, |
153
|
|
|
|
|
|
|
); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub _mk_query { |
156
|
1
|
|
|
1
|
|
1
|
my ($self) = @_; |
157
|
1
|
|
|
|
|
6
|
return { term => { distribution => $self->distribution } }; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub _mk_body { |
161
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
162
|
1
|
|
|
|
|
3
|
my $body = { query => $self->_mk_query }; |
163
|
1
|
50
|
|
|
|
15
|
if ( $self->sort ) { |
164
|
1
|
|
|
|
|
17
|
$body->{sort} = { 'stat.mtime' => $self->sort }; |
165
|
|
|
|
|
|
|
} |
166
|
1
|
|
|
|
|
10
|
return $body; |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub _mk_fields { |
170
|
1
|
|
|
1
|
|
12
|
return [qw(name version date status maturity stat download_url )]; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub _es_version { |
174
|
2
|
|
|
2
|
|
6
|
my ( $self, $wanted_version ) = @_; |
175
|
2
|
|
|
|
|
3
|
local $@ = undef; |
176
|
2
|
|
|
|
|
4
|
return eval { $self->es->VERSION($wanted_version); 1 }; ## no critic (RequireCheckingReturnValueOfEval) |
|
2
|
|
|
|
|
41
|
|
|
2
|
|
|
|
|
258436
|
|
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub _mk_scroll_args { |
180
|
1
|
|
|
1
|
|
1
|
my ($self) = @_; |
181
|
|
|
|
|
|
|
|
182
|
1
|
50
|
|
|
|
23
|
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
|
|
|
|
30
|
if ( not $self->sort ) { |
192
|
0
|
|
|
|
|
0
|
$scrollargs{'search_type'} = 'scan'; |
193
|
|
|
|
|
|
|
} |
194
|
1
|
|
|
|
|
22
|
return \%scrollargs; |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub _mk_query_distribution { |
198
|
1
|
|
|
1
|
|
1
|
my ($self) = @_; |
199
|
|
|
|
|
|
|
|
200
|
1
|
|
|
|
|
1
|
my %scrollargs = %{ $self->_mk_scroll_args }; |
|
1
|
|
|
|
|
4
|
|
201
|
|
|
|
|
|
|
|
202
|
1
|
50
|
|
|
|
5
|
( $self->_es_version(5) ) |
203
|
|
|
|
|
|
|
? ( require Search::Elasticsearch::Client::5_0::Scroll ) |
204
|
|
|
|
|
|
|
: ( require Search::Elasticsearch::Scroll ); |
205
|
|
|
|
|
|
|
|
206
|
1
|
|
|
|
|
11591
|
return $self->es->scroll_helper(%scrollargs); |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
2
|
|
|
2
|
|
4072
|
no Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
1; |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
__END__ |