line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::CPANRepo; |
2
|
1
|
|
|
1
|
|
788
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1499
|
use MetaCPAN::Client 1.005000; |
|
1
|
|
|
|
|
362258
|
|
|
1
|
|
|
|
|
40
|
|
9
|
1
|
|
|
1
|
|
828
|
use Getopt::Long (); |
|
1
|
|
|
|
|
10933
|
|
|
1
|
|
|
|
|
27
|
|
10
|
1
|
|
|
1
|
|
568
|
use Pod::Usage (); |
|
1
|
|
|
|
|
51276
|
|
|
1
|
|
|
|
|
58
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use Class::Accessor::Lite::Lazy ( |
13
|
|
|
|
|
|
|
new => 1, |
14
|
|
|
|
|
|
|
ro_lazy => { |
15
|
0
|
|
|
|
|
|
_client => sub { MetaCPAN::Client->new }, |
16
|
|
|
|
|
|
|
}, |
17
|
1
|
|
|
1
|
|
565
|
); |
|
1
|
|
|
|
|
2882
|
|
|
1
|
|
|
|
|
15
|
|
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
|
0
|
|
|
|
|
|
$repo =~ s{^git://github\.com}{https://github.com}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
return $repo; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub run { |
36
|
0
|
|
|
0
|
0
|
|
my ($class, @argv) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my ($opt, $argv) = $class->parse_options(@argv); |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $self = $class->new(%$opt); |
41
|
0
|
|
|
|
|
|
for my $module (@$argv) { |
42
|
0
|
|
0
|
|
|
|
print( ($self->resolve_repo($module) || '') . "\n"); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub parse_options { |
47
|
0
|
|
|
0
|
0
|
|
my ($class, @argv) = @_; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $parser = Getopt::Long::Parser->new( |
50
|
|
|
|
|
|
|
config => [qw/posix_default no_ignore_case bundling pass_through auto_help/], |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
local @ARGV = @argv; |
54
|
0
|
0
|
|
|
|
|
$parser->getoptions(\my %opt) or Pod::Usage::pod2usage(1); |
55
|
0
|
|
|
|
|
|
@argv = @ARGV; |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
Pod::Usage::pod2usage(1) unless @argv; |
58
|
0
|
|
|
|
|
|
(\%opt, \@argv); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
__END__ |