line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TMDB::Company; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
####################### |
4
|
|
|
|
|
|
|
# LOAD CORE MODULES |
5
|
|
|
|
|
|
|
####################### |
6
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
67
|
|
8
|
1
|
|
|
1
|
|
5
|
use Carp qw(croak carp); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
51
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
####################### |
11
|
|
|
|
|
|
|
# LOAD CPAN MODULES |
12
|
|
|
|
|
|
|
####################### |
13
|
1
|
|
|
1
|
|
4
|
use Object::Tiny qw(id session); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
14
|
1
|
|
|
1
|
|
148
|
use Params::Validate qw(validate_with :types); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
147
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
####################### |
17
|
|
|
|
|
|
|
# LOAD DIST MODULES |
18
|
|
|
|
|
|
|
####################### |
19
|
1
|
|
|
1
|
|
4
|
use TMDB::Session; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
####################### |
22
|
|
|
|
|
|
|
# VERSION |
23
|
|
|
|
|
|
|
####################### |
24
|
|
|
|
|
|
|
our $VERSION = '1.1.2'; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
####################### |
27
|
|
|
|
|
|
|
# PUBLIC METHODS |
28
|
|
|
|
|
|
|
####################### |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
## ==================== |
31
|
|
|
|
|
|
|
## Constructor |
32
|
|
|
|
|
|
|
## ==================== |
33
|
|
|
|
|
|
|
sub new { |
34
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
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
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(%opts); |
49
|
0
|
|
|
|
|
|
return $self; |
50
|
|
|
|
|
|
|
} ## end sub new |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
## ==================== |
53
|
|
|
|
|
|
|
## INFO |
54
|
|
|
|
|
|
|
## ==================== |
55
|
|
|
|
|
|
|
sub info { |
56
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
57
|
0
|
|
|
|
|
|
return $self->session->talk( |
58
|
|
|
|
|
|
|
{ |
59
|
|
|
|
|
|
|
method => 'company/' . $self->id(), |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} ## end sub info |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
## ==================== |
65
|
|
|
|
|
|
|
## VERSION |
66
|
|
|
|
|
|
|
## ==================== |
67
|
|
|
|
|
|
|
sub version { |
68
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
69
|
0
|
0
|
|
|
|
|
my $response = $self->session->talk( |
70
|
|
|
|
|
|
|
{ |
71
|
|
|
|
|
|
|
method => 'company/' . $self->id(), |
72
|
|
|
|
|
|
|
want_headers => 1, |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
) or return; |
75
|
0
|
|
0
|
|
|
|
my $version = $response->{etag} || q(); |
76
|
0
|
|
|
|
|
|
$version =~ s{"}{}gx; |
77
|
0
|
|
|
|
|
|
return $version; |
78
|
|
|
|
|
|
|
} ## end sub version |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
## ==================== |
81
|
|
|
|
|
|
|
## MOVIES |
82
|
|
|
|
|
|
|
## ==================== |
83
|
|
|
|
|
|
|
sub movies { |
84
|
0
|
|
|
0
|
0
|
|
my ( $self, $max_pages ) = @_; |
85
|
0
|
|
|
|
|
|
return $self->session->paginate_results( |
86
|
|
|
|
|
|
|
{ |
87
|
|
|
|
|
|
|
method => 'company/' . $self->id() . '/movies', |
88
|
|
|
|
|
|
|
max_pages => $max_pages, |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
); |
91
|
|
|
|
|
|
|
} ## end sub movies |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
## ==================== |
94
|
|
|
|
|
|
|
## INFO HELPERS |
95
|
|
|
|
|
|
|
## ==================== |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Name |
98
|
|
|
|
|
|
|
sub name { |
99
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
100
|
0
|
|
|
|
|
|
my $info = $self->info(); |
101
|
0
|
0
|
|
|
|
|
return unless $info; |
102
|
0
|
|
0
|
|
|
|
return $info->{name} || q(); |
103
|
|
|
|
|
|
|
} ## end sub name |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Logo |
106
|
|
|
|
|
|
|
sub logo { |
107
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
108
|
0
|
|
|
|
|
|
my $info = $self->info(); |
109
|
0
|
0
|
|
|
|
|
return unless $info; |
110
|
0
|
|
0
|
|
|
|
return $info->{logo_path} || q(); |
111
|
|
|
|
|
|
|
} ## end sub logo |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Image |
114
|
0
|
|
|
0
|
0
|
|
sub image { return shift->logo(); } |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
####################### |
117
|
|
|
|
|
|
|
1; |