line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Access::AdHoc::Default::CPAN::CPANPLUS; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
4374
|
use 5.008; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
148
|
|
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
20
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
110
|
|
6
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
101
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
20
|
use CPAN::Access::AdHoc::Util qw{ __load }; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
1289
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.000_18'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $configured = eval { |
13
|
|
|
|
|
|
|
__load( 'CPANPLUS::Configure' ); |
14
|
|
|
|
|
|
|
1; |
15
|
|
|
|
|
|
|
}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub get_default { |
18
|
2
|
|
|
2
|
1
|
9
|
my ( $class ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
2
|
50
|
|
|
|
7
|
$configured |
21
|
|
|
|
|
|
|
or return; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
24
|
my $cpp = CPANPLUS::Configure->new(); |
24
|
2
|
50
|
|
|
|
16
|
my $hosts = $cpp->get_conf( 'hosts' ) |
25
|
|
|
|
|
|
|
or return; |
26
|
2
|
50
|
|
|
|
6
|
@{ $hosts } |
|
2
|
|
|
|
|
11
|
|
27
|
|
|
|
|
|
|
or return; |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
2
|
foreach my $host ( @{ $hosts } ) { |
|
2
|
|
|
|
|
8
|
|
30
|
4
|
100
|
|
|
|
16
|
'file' eq $host->{scheme} |
31
|
|
|
|
|
|
|
and return _make_url( $host ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
5
|
return _make_url( $hosts->[0] ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _make_url { |
38
|
2
|
|
|
2
|
|
6
|
my @arg = @_; |
39
|
2
|
|
|
|
|
5
|
my @rslt; |
40
|
2
|
|
|
|
|
4
|
foreach my $host ( @arg ) { |
41
|
2
|
|
|
|
|
12
|
( my $path = $host->{path} ) =~ s{ \A (?! / ) }{/}smx; |
42
|
2
|
|
|
|
|
12
|
push @rslt, sprintf '%s://%s%s', $host->{scheme}, $host->{host}, $path; |
43
|
|
|
|
|
|
|
} |
44
|
2
|
|
|
|
|
18
|
return @rslt; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |