line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Releases::Latest::DistributionIterator; |
2
|
|
|
|
|
|
|
$CPAN::Releases::Latest::DistributionIterator::VERSION = '0.07'; |
3
|
1
|
|
|
1
|
|
27
|
use 5.006; |
|
1
|
|
|
|
|
2
|
|
4
|
1
|
|
|
1
|
|
5
|
use Moo; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
5
|
1
|
|
|
1
|
|
320
|
use CPAN::Releases::Latest; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
559
|
use CPAN::Releases::Latest::Distribution; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
7
|
1
|
|
|
1
|
|
566
|
use CPAN::Releases::Latest::Release; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
574
|
|
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
|
2341
|
my $self = shift; |
21
|
6
|
|
|
|
|
16
|
my $previous_release; |
22
|
|
|
|
|
|
|
|
23
|
6
|
|
|
|
|
34
|
$previous_release = $self->_previous_release(); |
24
|
6
|
50
|
66
|
|
|
73
|
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
|
|
|
|
|
118
|
my $release = $self->_next_release(); |
31
|
6
|
100
|
|
|
|
2496
|
if (defined($release)) { |
|
|
50
|
|
|
|
|
|
32
|
5
|
100
|
|
|
|
120
|
if (defined($previous_release)) { |
|
|
100
|
|
|
|
|
|
33
|
1
|
|
|
|
|
7
|
return $self->_dist_from_two_releases($previous_release, $release); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
elsif ($release->distinfo->maturity eq 'developer') { |
36
|
2
|
|
|
|
|
236
|
return _single_release_distribution($release); |
37
|
|
|
|
|
|
|
} else { |
38
|
2
|
|
|
|
|
250
|
my $next_release = $self->_next_release(); |
39
|
2
|
|
|
|
|
90
|
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
|
|
|
|
|
5
|
return undef; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _dist_from_two_releases |
53
|
|
|
|
|
|
|
{ |
54
|
3
|
|
|
3
|
|
8
|
my $self = shift; |
55
|
3
|
|
|
|
|
6
|
my $first_release = shift; |
56
|
3
|
|
|
|
|
9
|
my $second_release = shift; |
57
|
|
|
|
|
|
|
|
58
|
3
|
100
|
|
|
|
24
|
if ($first_release->distname eq $second_release->distname) { |
59
|
2
|
|
|
|
|
43
|
$self->_clear_previous_release(); |
60
|
2
|
|
|
|
|
664
|
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
|
|
|
|
|
7
|
$self->_previous_release($second_release); |
68
|
1
|
|
|
|
|
6
|
return _single_release_distribution($first_release); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _next_release |
73
|
|
|
|
|
|
|
{ |
74
|
8
|
|
|
8
|
|
21
|
my $self = shift; |
75
|
8
|
|
|
|
|
18
|
my $fh; |
76
|
|
|
|
|
|
|
|
77
|
8
|
100
|
|
|
|
41
|
if (not defined($fh = $self->_fh)) { |
78
|
1
|
|
|
|
|
14
|
$fh = $self->latest->_open_file(); |
79
|
1
|
|
|
|
|
9
|
$self->_fh($fh); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
8
|
|
|
|
|
43
|
my $line = <$fh>; |
83
|
|
|
|
|
|
|
|
84
|
8
|
100
|
|
|
|
29
|
if (defined($line)) { |
85
|
7
|
|
|
|
|
20
|
chomp($line); |
86
|
7
|
|
|
|
|
66
|
my ($distname, $path, $time, $size) = split(/\s+/, $line); |
87
|
7
|
|
|
|
|
238
|
return CPAN::Releases::Latest::Release->new( |
88
|
|
|
|
|
|
|
distname => $distname, |
89
|
|
|
|
|
|
|
path => $path, |
90
|
|
|
|
|
|
|
timestamp => $time, |
91
|
|
|
|
|
|
|
size => $size, |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
else { |
95
|
1
|
|
|
|
|
5
|
return undef; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub _single_release_distribution |
101
|
|
|
|
|
|
|
{ |
102
|
3
|
|
|
3
|
|
8
|
my $release = shift; |
103
|
3
|
|
|
|
|
107
|
my @args = (distname => $release->distinfo->dist); |
104
|
|
|
|
|
|
|
|
105
|
3
|
100
|
|
|
|
142
|
if ($release->distinfo->maturity eq 'developer') { |
106
|
2
|
|
|
|
|
32
|
push(@args, developer_release => $release); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
else { |
109
|
1
|
|
|
|
|
19
|
push(@args, release => $release); |
110
|
|
|
|
|
|
|
} |
111
|
3
|
|
|
|
|
106
|
return CPAN::Releases::Latest::Distribution->new(@args); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |