| 1 | 17 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 17 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | package MetaCPAN::API::File; | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 17 | our $VERSION = '0.52'; | |||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 17 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 17 | ▶ | use Moo::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 17 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | # /module/{module} | ||||||||||||||||||||
| 12 | # /file/{author}/{release}/{path} | ||||||||||||||||||||
| 13 | # /file/{author}/{release} | ||||||||||||||||||||
| 14 | # /file/{id} | ||||||||||||||||||||
| 15 | 6 | ▶ | sub file { | ||||||||||||||||||
|
Subroutine
file: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||
| 16 | 6 | my $self = shift; | |||||||||||||||||||
| 17 | 6 | my $url = ''; | |||||||||||||||||||
| 18 | 6 | my $error = "Either provide a module name, 'id', or 'author and 'release' and an optional 'path'"; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 6 | ▶ | if ( @_ == 1 ) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 21 | 1 | $url = 'module/' . shift; | |||||||||||||||||||
| 22 | } elsif ( @_ ) { | ||||||||||||||||||||
| 23 | 4 | my %opts = @_; | |||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 4 | ▶ | if ( defined ( my $id = $opts{'id'} ) ) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 26 | 1 | $url = "file/$id"; | |||||||||||||||||||
| 27 | ▶ | } elsif ( | |||||||||||||||||||
|
Condition66%2/3
defined(my $author = $opts{"author"}) and defined(my $release = $opts{"release"})
MC/DC50%1/2
defined(my $author = $opts{"author"}) and defined(my $release = $opts{"release"})
defined(my $author = $opts{"author"})
defined(my $release = $opts{"release"})
Truth table66%2/3
A and B
A= defined(my $author = $opts{"author"})B= defined(my $release = $opts{"release"})
| |||||||||||||||||||||
| 28 | defined ( my $author = $opts{'author'} ) && | ||||||||||||||||||||
| 29 | defined ( my $release = $opts{'release'} ) | ||||||||||||||||||||
| 30 | ) { | ||||||||||||||||||||
| 31 | 2 | ▶ | my $path = $opts{'path'} || ''; | ||||||||||||||||||
|
Condition100%2/2
$opts{'path'} || ''
MC/DC100%1/1
$opts{'path'} || ''
$opts{'path'}
Truth table100%2/2
A
A= $opts{'path'}
| |||||||||||||||||||||
| 32 | 2 | $url = "file/$author/$release/$path"; | |||||||||||||||||||
| 33 | } else { | ||||||||||||||||||||
| 34 | 1 | croak $error; | |||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | } else { | ||||||||||||||||||||
| 37 | 1 | croak $error; | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 4 | return $self->fetch( $url ); | |||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 17 | 1; | |||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||