line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::MirrorMerger::Mirror; |
2
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
59
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
46
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1114
|
use URI; |
|
2
|
|
|
|
|
9350
|
|
|
2
|
|
|
|
|
63
|
|
6
|
2
|
|
|
2
|
|
15
|
use URI::Escape (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
48
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use Class::Accessor::Lite ro => [qw/name base_url/]; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
17
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
4
|
|
|
4
|
0
|
2914
|
my ($class, $url) = @_; |
12
|
4
|
|
|
|
|
30
|
my $base_url = URI->new($url)->canonical(); |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
|
|
6344
|
my $scheme = $base_url->scheme; |
15
|
4
|
|
|
|
|
52
|
my $name; |
16
|
4
|
50
|
33
|
|
|
41
|
if ($scheme eq 'http' || $scheme eq 'https' || $scheme eq 'ftp') { |
|
|
50
|
33
|
|
|
|
|
17
|
0
|
|
|
|
|
0
|
$name = $base_url->host; |
18
|
|
|
|
|
|
|
} elsif ($scheme eq 'file') { |
19
|
4
|
|
|
|
|
15
|
$name = URI::Escape::uri_escape_utf8($base_url->file); |
20
|
|
|
|
|
|
|
} else { |
21
|
0
|
|
|
|
|
0
|
die "Unknown mirror scheme: $url"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
|
|
3034
|
bless { |
25
|
|
|
|
|
|
|
name => $name, |
26
|
|
|
|
|
|
|
base_url => $base_url, |
27
|
|
|
|
|
|
|
} => $class; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub index_url { |
31
|
3
|
|
|
3
|
0
|
9
|
my $self = shift; |
32
|
3
|
|
|
|
|
12
|
my $index_url = $self->base_url->clone(); |
33
|
3
|
|
|
|
|
59
|
$index_url->path(_join_path($index_url->path, 'modules/02packages.details.txt.gz')); |
34
|
3
|
|
|
|
|
132
|
return $index_url; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub package_url { |
38
|
3
|
|
|
3
|
0
|
8
|
my ($self, $path) = @_; |
39
|
|
|
|
|
|
|
|
40
|
3
|
|
|
|
|
10
|
my $package_url = $self->base_url->clone(); |
41
|
3
|
|
|
|
|
87
|
$package_url->path(_join_path($package_url->path, $self->package_path($path))); |
42
|
3
|
|
|
|
|
103
|
return $package_url; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub package_path { |
46
|
6
|
|
|
6
|
0
|
57
|
my ($self, $path) = @_; |
47
|
6
|
|
|
|
|
19
|
return "authors/id/$path"; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub _join_path { |
51
|
6
|
|
|
6
|
|
66
|
my $path = join '/', @_; |
52
|
6
|
|
|
|
|
64
|
$path =~ s!/+!/!g; # canonicalize |
53
|
6
|
|
|
|
|
24
|
return $path; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
__END__ |