line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyPAN::Index::Merged; |
2
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
107
|
|
3
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
10
|
use parent qw/AnyPAN::Index/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Class::Accessor::Lite |
8
|
2
|
|
|
2
|
|
121
|
ro => [qw/multiplex_index sources source_cache logger/]; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
24
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub save_with_included_packages { |
11
|
1
|
|
|
1
|
0
|
39
|
my ($self, $storage) = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
2
|
for my $source (@{ $self->sources }) { |
|
1
|
|
|
|
|
4
|
|
14
|
3
|
|
|
|
|
922
|
my $index = $self->source_cache->get_or_fetch_index($source); |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
|
|
19
|
my $previous_package_path = ''; |
17
|
3
|
|
|
|
|
5
|
for my $package_info (@{ $index->packages }) { |
|
3
|
|
|
|
|
8
|
|
18
|
|
|
|
|
|
|
# skip contiguous packages for performance |
19
|
3
|
50
|
|
|
|
22
|
next if $previous_package_path eq $package_info->canonicalized_path(); |
20
|
3
|
|
|
|
|
10
|
$previous_package_path = $package_info->canonicalized_path(); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# skip exists packages for performance |
23
|
3
|
|
|
|
|
8
|
my $save_key = $source->package_path($package_info->canonicalized_path); |
24
|
3
|
50
|
|
|
|
10
|
next if $storage->exists($save_key); |
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
|
|
99
|
my $package_path = eval { |
27
|
3
|
|
|
|
|
10
|
$self->source_cache->get_or_fetch_package($source, $package_info); |
28
|
|
|
|
|
|
|
}; |
29
|
3
|
50
|
|
|
|
15
|
if (my $e = $@) { |
30
|
0
|
0
|
|
|
|
0
|
if (AnyPAN::Agent::Exception::NotFound->caught($e)) { |
31
|
0
|
|
|
|
|
0
|
$self->logger->warn("skip package @{[ $package_info->path ]} on @{[ $source->name ]}"); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
32
|
0
|
|
|
|
|
0
|
next; # skip it |
33
|
|
|
|
|
|
|
} |
34
|
0
|
|
|
|
|
0
|
$self->logger->error("failed to fetch package @{[ $package_info->path ]} on @{[ $source->name ]}"); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
35
|
0
|
|
|
|
|
0
|
die $e; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
3
|
|
|
|
|
13
|
$storage->copy($package_path, $save_key); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
1
|
|
|
|
|
506
|
$self->save($storage); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
__END__ |