line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Cover::Results::ReleaseIterator; |
2
|
|
|
|
|
|
|
$CPAN::Cover::Results::ReleaseIterator::VERSION = '0.03'; |
3
|
1
|
|
|
1
|
|
2239
|
use Moo; |
|
1
|
|
|
|
|
13622
|
|
|
1
|
|
|
|
|
5
|
|
4
|
1
|
|
|
1
|
|
1716
|
use autodie; |
|
1
|
|
|
|
|
13219
|
|
|
1
|
|
|
|
|
7
|
|
5
|
1
|
|
|
1
|
|
5753
|
use JSON qw/ decode_json /; |
|
1
|
|
|
|
|
11036
|
|
|
1
|
|
|
|
|
647
|
|
6
|
1
|
|
|
1
|
|
145
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
59
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
395
|
use CPAN::Cover::Results::Release; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
349
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'results' => ( is => 'ro' ); |
11
|
|
|
|
|
|
|
has '_results_data' => ( is => 'lazy' ); |
12
|
|
|
|
|
|
|
has '_keys' => ( is => 'lazy' ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _build__results_data |
15
|
|
|
|
|
|
|
{ |
16
|
0
|
|
|
0
|
|
|
my $self = shift; |
17
|
0
|
|
|
|
|
|
my $fh = $self->results->open_file(); |
18
|
0
|
|
|
|
|
|
local $/; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $json_text = <$fh>; |
21
|
0
|
|
|
|
|
|
close($fh); |
22
|
0
|
|
|
|
|
|
return decode_json($json_text); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _build__keys |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
|
|
my $self = shift; |
28
|
0
|
|
|
|
|
|
my $results_ref = $self->_results_data; |
29
|
0
|
|
|
|
|
|
my $keypair_listref = []; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
foreach my $distname (sort { lc($a) cmp lc($b) } keys %$results_ref) { |
|
0
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
foreach my $version (sort keys %{ $results_ref->{$distname} }) { |
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
next unless exists($results_ref->{$distname}{$version}{coverage}{total}) |
34
|
0
|
0
|
0
|
|
|
|
&& int(keys %{ $results_ref->{$distname}{$version}{coverage}{total} }) > 0; |
35
|
0
|
|
|
|
|
|
push(@$keypair_listref, [$distname, $version]); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return $keypair_listref; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub next |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
45
|
0
|
|
|
|
|
|
my $data_ref = $self->_results_data; |
46
|
0
|
|
|
|
|
|
my $keypair_listref = $self->_keys; |
47
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
return undef unless @$keypair_listref > 0; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $keypair = shift @$keypair_listref; |
51
|
0
|
|
|
|
|
|
my ($distname, $version) = @$keypair; |
52
|
0
|
|
|
|
|
|
my $result_record = { |
53
|
|
|
|
|
|
|
distname => $distname, |
54
|
|
|
|
|
|
|
version => $version, |
55
|
0
|
|
|
|
|
|
%{ $data_ref->{$distname}->{$version}->{coverage}->{total} }, |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return CPAN::Cover::Results::Release->new($result_record); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|