line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Releases::Latest::DistributionIterator; |
2
|
|
|
|
|
|
|
$CPAN::Releases::Latest::DistributionIterator::VERSION = '0.08'; |
3
|
1
|
|
|
1
|
|
23
|
use 5.006; |
|
1
|
|
|
|
|
5
|
|
4
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
1
|
|
|
1
|
|
226
|
use CPAN::Releases::Latest; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
6
|
1
|
|
|
1
|
|
341
|
use CPAN::Releases::Latest::Distribution; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
7
|
1
|
|
|
1
|
|
337
|
use CPAN::Releases::Latest::Release; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
694
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'latest' => |
10
|
|
|
|
|
|
|
( |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
default => sub { CPAN::Releases::Latest->new() }, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has _fh => (is => 'rw'); |
16
|
|
|
|
|
|
|
has _previous_release => (is => 'rw', clearer => 1); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub next_distribution |
19
|
|
|
|
|
|
|
{ |
20
|
6
|
|
|
6
|
0
|
1685
|
my $self = shift; |
21
|
6
|
|
|
|
|
7
|
my $previous_release; |
22
|
|
|
|
|
|
|
|
23
|
6
|
|
|
|
|
12
|
$previous_release = $self->_previous_release(); |
24
|
6
|
50
|
66
|
|
|
36
|
if ( defined($previous_release) |
25
|
|
|
|
|
|
|
&& $previous_release->distinfo->maturity eq 'developer') { |
26
|
0
|
|
|
|
|
0
|
$self->_clear_previous_release(); |
27
|
0
|
|
|
|
|
0
|
return _single_release_distribution($previous_release); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
6
|
|
|
|
|
51
|
my $release = $self->_next_release(); |
31
|
6
|
100
|
|
|
|
1689
|
if (defined($release)) { |
|
|
50
|
|
|
|
|
|
32
|
5
|
100
|
|
|
|
97
|
if (defined($previous_release)) { |
|
|
100
|
|
|
|
|
|
33
|
1
|
|
|
|
|
3
|
return $self->_dist_from_two_releases($previous_release, $release); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
elsif ($release->distinfo->maturity eq 'developer') { |
36
|
2
|
|
|
|
|
92
|
return _single_release_distribution($release); |
37
|
|
|
|
|
|
|
} else { |
38
|
2
|
|
|
|
|
156
|
my $next_release = $self->_next_release(); |
39
|
2
|
|
|
|
|
39
|
return $self->_dist_from_two_releases($release, $next_release); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
elsif (defined($previous_release)) { |
43
|
0
|
|
|
|
|
0
|
$self->_clear_previous_release(); |
44
|
0
|
|
|
|
|
0
|
return _single_release_distribution($previous_release); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
else { |
47
|
1
|
|
|
|
|
2
|
return undef; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _dist_from_two_releases |
53
|
|
|
|
|
|
|
{ |
54
|
3
|
|
|
3
|
|
4
|
my $self = shift; |
55
|
3
|
|
|
|
|
5
|
my $first_release = shift; |
56
|
3
|
|
|
|
|
3
|
my $second_release = shift; |
57
|
|
|
|
|
|
|
|
58
|
3
|
100
|
|
|
|
15
|
if ($first_release->distname eq $second_release->distname) { |
59
|
2
|
|
|
|
|
43
|
$self->_clear_previous_release(); |
60
|
2
|
|
|
|
|
32
|
return CPAN::Releases::Latest::Distribution->new( |
61
|
|
|
|
|
|
|
distname => $first_release->distname, |
62
|
|
|
|
|
|
|
release => $first_release, |
63
|
|
|
|
|
|
|
developer_release => $second_release, |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
else { |
67
|
1
|
|
|
|
|
5
|
$self->_previous_release($second_release); |
68
|
1
|
|
|
|
|
3
|
return _single_release_distribution($first_release); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _next_release |
73
|
|
|
|
|
|
|
{ |
74
|
8
|
|
|
8
|
|
9
|
my $self = shift; |
75
|
8
|
|
|
|
|
7
|
my $fh; |
76
|
|
|
|
|
|
|
|
77
|
8
|
100
|
|
|
|
29
|
if (not defined($fh = $self->_fh)) { |
78
|
1
|
|
|
|
|
6
|
$fh = $self->latest->_open_file(); |
79
|
1
|
|
|
|
|
6
|
$self->_fh($fh); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
8
|
|
|
|
|
23
|
my $line = <$fh>; |
83
|
|
|
|
|
|
|
|
84
|
8
|
100
|
|
|
|
14
|
if (defined($line)) { |
85
|
7
|
|
|
|
|
8
|
chomp($line); |
86
|
7
|
|
|
|
|
39
|
my ($distname, $path, $time, $size) = split(/\s+/, $line); |
87
|
7
|
|
|
|
|
134
|
return CPAN::Releases::Latest::Release->new( |
88
|
|
|
|
|
|
|
distname => $distname, |
89
|
|
|
|
|
|
|
path => $path, |
90
|
|
|
|
|
|
|
timestamp => $time, |
91
|
|
|
|
|
|
|
size => $size, |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
else { |
95
|
1
|
|
|
|
|
3
|
return undef; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub _single_release_distribution |
101
|
|
|
|
|
|
|
{ |
102
|
3
|
|
|
3
|
|
3
|
my $release = shift; |
103
|
3
|
|
|
|
|
41
|
my @args = (distname => $release->distinfo->dist); |
104
|
|
|
|
|
|
|
|
105
|
3
|
100
|
|
|
|
52
|
if ($release->distinfo->maturity eq 'developer') { |
106
|
2
|
|
|
|
|
11
|
push(@args, developer_release => $release); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
else { |
109
|
1
|
|
|
|
|
7
|
push(@args, release => $release); |
110
|
|
|
|
|
|
|
} |
111
|
3
|
|
|
|
|
39
|
return CPAN::Releases::Latest::Distribution->new(@args); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |