| 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::Author; | ||||||||||||||||||||||||||||
| 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 | # /author/{author} | ||||||||||||||||||||||||||||
| 12 | 2 | ▶ | sub author { | ||||||||||||||||||||||||||
|
Subroutine
author: called CC=7 SCAR=31.1
Pod
documented
| |||||||||||||||||||||||||||||
| 13 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 14 | 2 | my ( $url, %extra_opts ); | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 2 | ▶ | if ( @_ == 1 ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 17 | 1 | $url = 'author/' . shift; | |||||||||||||||||||||||||||
| 18 | } elsif ( @_ == 2 ) { | ||||||||||||||||||||||||||||
| 19 | 0 | my %opts = @_; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if ( defined $opts{'pauseid'} ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 22 | 0 | $url = "author/" . $opts{'pauseid'}; | |||||||||||||||||||||||||||
| 23 | } elsif ( defined $opts{'search'} ) { | ||||||||||||||||||||||||||||
| 24 | 0 | my $search_opts = $opts{'search'}; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | croak "'search' key must be 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"
| |||||||||||||||||||||||||||||
| 27 | unless ref $search_opts && ref $search_opts eq 'HASH'; | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | %extra_opts = %{$search_opts}; | |||||||||||||||||||||||||||
| 30 | 0 | $url = 'author/_search'; | |||||||||||||||||||||||||||
| 31 | } else { | ||||||||||||||||||||||||||||
| 32 | 0 | croak 'Unknown option given'; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | } else { | ||||||||||||||||||||||||||||
| 35 | 1 | croak 'Please provide an author PAUSEID or a "search"'; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 1 | return $self->fetch( $url, %extra_opts ); | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 17 | 1; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | __END__ | ||||||||||||||||||||||||||||