line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::UpdateCPANfile::PackageDetails; |
2
|
2
|
|
|
2
|
|
234233
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
75
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
65
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1167
|
use CPAN::PackageDetails; |
|
2
|
|
|
|
|
27822
|
|
|
2
|
|
|
|
|
82
|
|
6
|
2
|
|
|
2
|
|
1736
|
use LWP::UserAgent; |
|
2
|
|
|
|
|
91582
|
|
|
2
|
|
|
|
|
97
|
|
7
|
2
|
|
|
2
|
|
1273
|
use IO::String; |
|
2
|
|
|
|
|
8138
|
|
|
2
|
|
|
|
|
539
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
9
|
|
|
9
|
0
|
18136
|
my ($class) = @_; |
11
|
|
|
|
|
|
|
|
12
|
9
|
|
|
|
|
77
|
bless {}, $class; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Parsing detail is heavy operation. |
16
|
|
|
|
|
|
|
my $details_cache; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub details { |
19
|
31
|
|
|
31
|
0
|
604
|
my ($self) = @_; |
20
|
31
|
100
|
|
|
|
153
|
if ($details_cache) { |
21
|
29
|
|
|
|
|
228
|
return $details_cache; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
2
|
|
|
|
|
23
|
my $agent = LWP::UserAgent->new( |
25
|
|
|
|
|
|
|
agent => 'UpdateCPANfile/0.1', |
26
|
|
|
|
|
|
|
timeout => 60, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
5397
|
my $file = IO::String->new; |
30
|
2
|
|
|
|
|
127
|
my $res = $agent->get('http://www.cpan.org/modules/02packages.details.txt.gz'); |
31
|
2
|
|
|
|
|
47195
|
$file->print($res->content); |
32
|
2
|
|
|
|
|
16511
|
$file->setpos(0); |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
65
|
$details_cache = CPAN::PackageDetails->read( $file ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub clear_details_cache { |
38
|
0
|
|
|
0
|
0
|
0
|
$details_cache = undef; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub package_object { |
42
|
30
|
|
|
30
|
0
|
44252299
|
my ($self, $package) = @_; |
43
|
30
|
|
|
|
|
171
|
my ($package_object) = $self->details->entries->get_entries_by_package($package); |
44
|
30
|
|
|
|
|
59703661
|
$package_object; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub latest_version_for_package { |
48
|
2
|
|
|
2
|
0
|
2858
|
my ($self, $package) = @_; |
49
|
2
|
|
|
|
|
24
|
my $package_object = $self->package_object($package); |
50
|
2
|
50
|
|
|
|
40
|
return undef unless $package_object; |
51
|
2
|
|
|
|
|
37
|
return $package_object->version; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |