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