blib/lib/TMDB/Genre.pm

filter: Statementstmt 58.8% 20 / 34 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 3 totaltotal 44.0% 26 / 59 SCAR 27.6
CC
7
Cov
43%
list
30.0
movies
12.0
new
2.0
CRAP 15.8
« blib/lib/TMDB/Company.pm ↑ Summary Build »
1 package TMDB::Genre;
2  
3 #######################
4 # LOAD CORE MODULES
5 #######################
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Carp qw(croak carp);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 #######################
11 # LOAD CPAN MODULES
12 #######################
13 1 ▶use Object::Tiny qw(id session);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Params::Validate qw(validate_with :types);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 #######################
17 # LOAD DIST MODULES
18 #######################
19 1 ▶use TMDB::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 #######################
22 # VERSION
23 #######################
24 1 our $VERSION = '1.2.1';
25  
26 #######################
27 # PUBLIC METHODS
28 #######################
29  
30 ## ====================
31 ## Constructor
32 ## ====================
33 sub new {
34 0 ▶ my $class = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
35 0 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 0 my $self = $class->SUPER::new(%opts);
50 0 return $self;
51 } ## end sub new
52  
53 ## ====================
54 ## LIST
55 ## ====================
56 sub list {
57 0 ▶ my ($self) = @_;
Subroutine list: not called CC=5 SCAR=34.0
Pod undocumented
58 0 ▶ my $response = $self->session->talk(
Branch: 1 branch
BranchTrueFalseTotal
$self->session->lang ? : 0 0 0
59 {
60 method => 'genre/list',
61 params => {
62 language => $self->session->lang
63 ? $self->session->lang
64 : undef,
65 },
66 }
67 );
68 0 ▶ return unless $response;
Branch: 1 branch
BranchTrueFalseTotal
unless $response 0 0 0
69  
70 0 my $genres;
71 0 ▶ $genres = $response->{genres} || [];
Condition0%0/2
$response->{'genres'} || []
l!l
00
MC/DC0%0/1
$response->{'genres'} || []
$response->{'genres'}
Truth table0%0/2
A
A= $response->{'genres'}
Aresult
11
00
72 0 ▶ return @$genres if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 0 0 0
73 0 return $genres;
74 } ## end sub list
75  
76 ## ====================
77 ## MOVIES
78 ## ====================
79 sub movies {
80 0 ▶ my ( $self, $max_pages ) = @_;
Subroutine movies: not called CC=3 SCAR=24.8
Pod undocumented
81 0 ▶ return unless $self->id();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->id 0 0 0
82 0 ▶ return $self->session->paginate_results(
Branch: 1 branch
BranchTrueFalseTotal
$self->session->lang ? : 0 0 0
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 1 1;
« blib/lib/TMDB/Company.pm ↑ Summary Build »