line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::CPANRepo; |
2
|
1
|
|
|
1
|
|
1060
|
use 5.008001; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
41
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
17
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
874
|
use MetaCPAN::Client 1.005000; |
|
1
|
|
|
|
|
526492
|
|
|
1
|
|
|
|
|
43
|
|
9
|
1
|
|
|
1
|
|
1368
|
use Getopt::Long (); |
|
1
|
|
|
|
|
14344
|
|
|
1
|
|
|
|
|
31
|
|
10
|
1
|
|
|
1
|
|
1416
|
use Pod::Usage (); |
|
1
|
|
|
|
|
61161
|
|
|
1
|
|
|
|
|
69
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use Class::Accessor::Lite::Lazy ( |
13
|
|
|
|
|
|
|
new => 1, |
14
|
|
|
|
|
|
|
ro_lazy => { |
15
|
0
|
|
|
|
|
|
_client => sub { MetaCPAN::Client->new }, |
16
|
|
|
|
|
|
|
}, |
17
|
1
|
|
|
1
|
|
1116
|
); |
|
1
|
|
|
|
|
4288
|
|
|
1
|
|
|
|
|
16
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub resolve_repo { |
20
|
0
|
|
|
0
|
1
|
|
my ($self, $name) = @_; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $repo; |
23
|
0
|
|
|
|
|
|
eval { |
24
|
0
|
|
|
|
|
|
my $module = $self->_client->module($name); |
25
|
0
|
|
|
|
|
|
my $release = $self->_client->release($module->distribution); |
26
|
0
|
0
|
|
|
|
|
if ($release->resources->{repository}) { |
27
|
0
|
|
|
|
|
|
$repo = $release->resources->{repository}{url}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
return $repo; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub run { |
35
|
0
|
|
|
0
|
0
|
|
my ($class, @argv) = @_; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my ($opt, $argv) = $class->parse_options(@argv); |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $self = $class->new(%$opt); |
40
|
0
|
|
|
|
|
|
for my $module (@$argv) { |
41
|
0
|
|
0
|
|
|
|
print( ($self->resolve_repo($module) || '') . "\n"); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub parse_options { |
46
|
0
|
|
|
0
|
0
|
|
my ($class, @argv) = @_; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $parser = Getopt::Long::Parser->new( |
49
|
|
|
|
|
|
|
config => [qw/posix_default no_ignore_case bundling pass_through auto_help/], |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
local @ARGV = @argv; |
53
|
0
|
0
|
|
|
|
|
$parser->getoptions(\my %opt) or Pod::Usage::pod2usage(1); |
54
|
0
|
|
|
|
|
|
@argv = @ARGV; |
55
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
|
Pod::Usage::pod2usage(1) unless @argv; |
57
|
0
|
|
|
|
|
|
(\%opt, \@argv); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |