API/Release.pm

filter: Statementstmt 87.5% 28 / 32 Branchbran 75.0% 9 / 12 Conditioncond 33.3% 2 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 77.0% 47 / 61 CC 9 SCAR 20.9
CC
9
Cov
78%
release
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 8.1
« API/Rating.pm ↑ Summary API/POD.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::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
BranchTrueFalseTotal
@_ ? : 3 1 4
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
BranchTrueFalseTotal
%opts or croak($error) 3 1 4
21  
22 3 my %extra_opts = ();
23  
24 3 ▶ if ( defined ( my $dist = $opts{'distribution'} ) ) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined(my $dist = $opts{'distribution'})) { } 1 2 3
elsif (defined(my $author = $opts{'author'}) and defined(my $release = $opts{'release'})) { } 1 1 2
elsif (defined(my $search_opts = $opts{'search'})) { } 0 1 1
25 1 $url = "release/$dist";
26 ▶ } elsif (
Condition66%2/3
defined(my $author = $opts{"author"}) and defined(my $release = $opts{"release"})
!ll&&!rl&&r
101
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"})
ABresult
0X0
100
111
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
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
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__
« API/Rating.pm ↑ Summary API/POD.pm »