TMDB/Genre.pm

filter: Statementstmt 100% 34 / 34 Branchbran 50.0% 5 / 10 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 3 totaltotal 83.0% 49 / 59 CC 7 SCAR 10.8
CC
7
Cov
87%
list
5.5
movies
3.2
BEGIN
1.0
CRAP 2.9
« TMDB/Person.pm ↑ Summary TMDB/Collection.pm »
1 package TMDB::Genre;
2  
3 #######################
4 # LOAD CORE MODULES
5 #######################
6 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Carp qw(croak carp);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 #######################
11 # LOAD CPAN MODULES
12 #######################
13 3 ▶use Object::Tiny qw(id session);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use Params::Validate qw(validate_with :types);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 #######################
17 # LOAD DIST MODULES
18 #######################
19 3 ▶use TMDB::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 #######################
22 # VERSION
23 #######################
24 3 our $VERSION = '1.3.0';
25  
26 #######################
27 # PUBLIC METHODS
28 #######################
29  
30 ## ====================
31 ## Constructor
32 ## ====================
33 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
34 1 my $class = shift;
35 1 my %opts = validate_with(
36 params => \@_,
37 spec => {
38 session => {
39 type => OBJECT,
40 isa => 'TMDB::Session',
41 },
42 id => {
43 type => SCALAR,
44 optional => 1,
45 },
46 },
47 );
48  
49 1 my $self = $class->SUPER::new(%opts);
50 1 return $self;
51 } ## end sub new
52  
53 ## ====================
54 ## LIST
55 ## ====================
56 1 ▶sub list {
Subroutine list: called CC=5 SCAR=17.0
Pod undocumented
57 1 my ($self) = @_;
58 1 ▶ my $response = $self->session->talk(
Branch: 1 branch
BranchTrueFalseTotal
$self->session->lang ? : 1 0 1
59 {
60 method => 'genre/list',
61 params => {
62 language => $self->session->lang
63 ? $self->session->lang
64 : undef,
65 },
66 }
67 );
68 1 ▶ return unless $response;
Branch: 1 branch
BranchTrueFalseTotal
unless $response 0 1 1
69  
70 1 my $genres;
71 1 ▶ $genres = $response->{genres} || [];
Condition50%1/2
$response->{'genres'} || []
l!l
01
MC/DC0%0/1
$response->{'genres'} || []
$response->{'genres'}
Truth table50%1/2
A
A= $response->{'genres'}
Aresult
11
00
72 1 ▶ return @$genres if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 0 1 1
73 1 return $genres;
74 } ## end sub list
75  
76 ## ====================
77 ## MOVIES
78 ## ====================
79 1 ▶sub movies {
Subroutine movies: called CC=3 SCAR=11.7
Pod undocumented
80 1 my ( $self, $max_pages ) = @_;
81 1 ▶ return unless $self->id();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->id 0 1 1
82 1 ▶ return $self->session->paginate_results(
Branch: 1 branch
BranchTrueFalseTotal
$self->session->lang ? : 1 0 1
83 {
84 method => 'genre/' . $self->id() . '/movies',
85 max_pages => $max_pages,
86 params => {
87 language => $self->session->lang
88 ? $self->session->lang
89 : undef,
90 },
91 }
92 );
93 } ## end sub movies
94  
95 #######################
96 3 1;
« TMDB/Person.pm ↑ Summary TMDB/Collection.pm »