API/Author.pm

filter: Statementstmt 71.8% 23 / 32 Branchbran 30.0% 3 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 61.1% 33 / 54 CC 7 SCAR 26.0
CC
7
Cov
58%
author
22.3
BEGIN
1.0
BEGIN
1.0
CRAP 13.4
↑ Summary API/Rating.pm »
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
BranchTrueFalseTotal
if (@_ == 1) { } 1 1 2
elsif (@_ == 2) { } 0 1 1
17 1 $url = 'author/' . shift;
18 } elsif ( @_ == 2 ) {
19 0 my %opts = @_;
20  
21 0 ▶ if ( defined $opts{'pauseid'} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $opts{'pauseid'}) { } 0 0 0
elsif (defined $opts{'search'}) { } 0 0 0
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
BranchTrueFalseTotal
unless ref $search_opts and ref $search_opts eq "HASH" 0 0 0
Condition0%0/3
ref $search_opts and ref $search_opts eq "HASH"
!ll&&!rl&&r
000
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"
ABresult
0X0
100
111
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__
↑ Summary API/Rating.pm »