| 1 | package App::CPANRepo; | ||||||||||||
| 2 | 1 | ▶ | use 5.008001; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 1 | our $VERSION = "0.02"; | |||||||||||
| 7 | |||||||||||||
| 8 | 1 | ▶ | use MetaCPAN::Client 1.005000; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 1 | ▶ | use Getopt::Long (); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 1 | ▶ | use Pod::Usage (); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | |||||||||||||
| 12 | 1 | ▶ | use Class::Accessor::Lite::Lazy ( | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||
| 13 | new => 1, | ||||||||||||
| 14 | ro_lazy => { | ||||||||||||
| 15 | 0 | ▶ | _client => sub { MetaCPAN::Client->new }, | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 16 | }, | ||||||||||||
| 17 | 1 | ); | |||||||||||
| 18 | |||||||||||||
| 19 | 0 | ▶ | sub resolve_repo { | ||||||||||
|
Subroutine
resolve_repo: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 20 | 0 | 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 | ▶ | if ($release->resources->{repository}) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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 | 0 | ▶ | sub run { | ||||||||||
|
Subroutine
run: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 36 | 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 | ▶ | print( ($self->resolve_repo($module) || '') . "\n"); | ||||||||||
|
Condition0%0/2
$self->resolve_repo($module) || ''
MC/DC0%0/1
$self->resolve_repo($module) || ''
$self->resolve_repo($module)
Truth table0%0/2
A
A= $self->resolve_repo($module)
| |||||||||||||
| 43 | } | ||||||||||||
| 44 | } | ||||||||||||
| 45 | |||||||||||||
| 46 | 0 | ▶ | sub parse_options { | ||||||||||
|
Subroutine
parse_options: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 47 | 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 | ▶ | $parser->getoptions(\my %opt) or Pod::Usage::pod2usage(1); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 55 | 0 | @argv = @ARGV; | |||||||||||
| 56 | |||||||||||||
| 57 | 0 | ▶ | Pod::Usage::pod2usage(1) unless @argv; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 58 | 0 | (\%opt, \@argv); | |||||||||||
| 59 | } | ||||||||||||
| 60 | |||||||||||||
| 61 | 1 | 1; | |||||||||||
| 62 | __END__ | ||||||||||||