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