| 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::Release; | ||||||||||||||||||||||||||||
| 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 | # /release/{distribution} | ||||||||||||||||||||||||||||
| 12 | # /release/{author}/{release} | ||||||||||||||||||||||||||||
| 13 | 4 | ▶ | sub release { | ||||||||||||||||||||||||||
|
Subroutine
release: called CC=9 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 15 | 4 | ▶ | my %opts = @_ ? @_ : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 16 | 4 | my $url = ''; | |||||||||||||||||||||||||||
| 17 | 4 | my $error = "Either provide 'distribution', or 'author' and 'release', " . | |||||||||||||||||||||||||||
| 18 | "or 'search'"; | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 4 | ▶ | %opts or croak $error; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 3 | my %extra_opts = (); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 3 | ▶ | if ( defined ( my $dist = $opts{'distribution'} ) ) { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 25 | 1 | $url = "release/$dist"; | |||||||||||||||||||||||||||
| 26 | ▶ | } 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"})
| |||||||||||||||||||||||||||||
| 27 | defined ( my $author = $opts{'author'} ) && | ||||||||||||||||||||||||||||
| 28 | defined ( my $release = $opts{'release'} ) | ||||||||||||||||||||||||||||
| 29 | ) { | ||||||||||||||||||||||||||||
| 30 | 1 | $url = "release/$author/$release"; | |||||||||||||||||||||||||||
| 31 | } elsif ( defined ( my $search_opts = $opts{'search'} ) ) { | ||||||||||||||||||||||||||||
| 32 | 0 | ▶ | croak "search option must by a hashref" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $search_opts and ref $search_opts eq "HASH"
MC/DC0%0/2
ref $search_opts and ref $search_opts eq "HASH"
ref $search_opts
ref $search_opts eq "HASH"
Truth table0%0/3
A and B
A= ref $search_optsB= ref $search_opts eq "HASH"
| |||||||||||||||||||||||||||||
| 33 | unless ref $search_opts && ref $search_opts eq 'HASH'; | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | %extra_opts = %{$search_opts}; | |||||||||||||||||||||||||||
| 36 | 0 | $url = 'release/_search'; | |||||||||||||||||||||||||||
| 37 | } else { | ||||||||||||||||||||||||||||
| 38 | 1 | croak $error; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 2 | return $self->fetch( $url, %extra_opts ); | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 17 | 1; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||||||||||