lib/IMDB/Local/Rating.pm

filter: Statementstmt 51.8% 28 / 54 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 64.2% 9 / 14 Podpod 0.0% 0 / 5 totaltotal 44.5% 37 / 83 SCAR 27.5
CC
7
Cov
44%
createNew
12.0
getIDs
12.0
init
6.0
CRAP 15.7
« lib/IMDB/Local/Plot.pm ↑ Summary lib/IMDB/Local/QualifierType.pm »
1 package IMDB::Local::Rating;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 IMDB::Local::Rating - Object representation of Rating information.
10  
11 =head1 VERSION
12  
13 Version 0.01
14  
15 =cut
16  
17 1 our $VERSION = '1.00';
18  
19 =head1 SYNOPSIS
20  
21 Quick summary of what the module does.
22  
23 Perhaps a little code snippet.
24  
25 use IMDB::Local::Rating;
26  
27 my $foo = IMDB::Local::Rating->new();
28 ...
29  
30 =head1 EXPORT
31  
32 A list of functions that can be exported. You can delete this section
33 if you don't export anything, such as for a purely object-oriented module.
34  
35 =head1 SUBROUTINES/METHODS
36  
37 =head2 function1
38  
39 =cut
40  
41 1 ▶use IMDB::Local::DB::BaseObject;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 1 ▶use base qw(IMDB::Local::DB::BaseObject);
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 1 ▶use constant DB_TABLE => 'Ratings';
Subroutine BEGIN: called CC=1 SCAR=0.0
45 1 ▶use constant DB_KEY => 'TitleID';
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 use Class::MethodMaker
48 [
49 1 scalar => [DB_KEY],
50 array => [qw/ -static db_columns/],
51 new => [qw/ -init -hash new/] ,
52 1 ▶ ];
Subroutine BEGIN: called CC=1 SCAR=0.0
53  
54 sub init($)
55 {
56 0 ▶ my ($self)=@_;
Subroutine init: not called CC=2 SCAR=17.9
Pod undocumented
57  
58 # static array needs to be initialized only if it isn't already
59 #if ( !$self->db_ignoredColumns_count ) {
60 #$self->db_ignoredColumns_push(DB_COLUMNS_IGNORE);
61 #}
62  
63 0 $self->initHandle(DB_TABLE, DB_KEY);
64  
65 0 ▶ if ( $self->populateUsingKey($self->get(DB_KEY)) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->populateUsingKey($self->get("TitleID"))) 0 0 0
66 0 return $self;
67 }
68 0 return(undef);
69 }
70  
71 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
72  
73 sub createNew($%)
74 {
75 0 ▶ my ($imdbdb, %args)=@_;
Subroutine createNew: not called CC=3 SCAR=24.8
Pod undocumented
76  
77 0 ▶ carp("no name given") if ( !defined($args{name}) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args{"name"} 0 0 0
78  
79 0 my $id=$imdbdb->insert_db(DB_TABLE, DB_KEY, %args);
80 0 ▶ if ( !defined($id) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $id) 0 0 0
81 0 return(undef);
82 }
83 0 return new IMDB::Local::Rating(imdbdb=>$imdbdb, TableID=>$id);
84 }
85  
86 sub findByPlotID($$)
87 {
88 0 ▶ my ($imdbdb, $id)=@_;
Subroutine findByPlotID: not called CC=1 SCAR=6.9
Pod undocumented
89 0 return new IMDB::Local::Rating(imdbdb=>$imdbdb, DB_KEY, $id);
90 }
91  
92 sub findByName($$)
93 {
94 0 ▶ my ($imdbdb, $name)=@_;
Subroutine findByName: not called CC=2 SCAR=17.9
Pod undocumented
95  
96 0 my $id=$imdbdb->select2Scalar("SELECT ".DB_KEY." from ".DB_TABLE." where name='$name'");
97 0 ▶ if ( defined($id) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $id) 0 0 0
98 0 return new IMDB::Local::Rating(imdbdb=>$imdbdb, DB_KEY, $id);
99 }
100 0 return(undef);
101 }
102  
103 sub getIDs($$)
104 {
105 0 ▶ my ($class, $imdbdb)=@_;
Subroutine getIDs: not called CC=3 SCAR=24.8
Pod undocumented
106 0 my @ids;
107  
108 0 my $res=$imdbdb->dbh->selectall_arrayref("SELECT ".DB_KEY." FROM ".DB_TABLE." ORDER BY ".DB_KEY."");
109 0 ▶ if ( !defined($res) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $res) 0 0 0
110 0 return(@ids);
111 }
112  
113 0 for my $list (@$res) {
114 0 push(@ids, $list->[0]);
115 }
116 0 return(@ids);
117 }
118  
119 =head1 AUTHOR
120  
121 jerryv, C<< <jerry.veldhuis at gmail.com> >>
122  
123 =head1 BUGS
124  
125 Please report any bugs or feature requests to C<bug-imdb-local at rt.cpan.org>, or through
126 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=IMDB-Local>. I will be notified, and then you'll
127 automatically be notified of progress on your bug as I make changes.
128  
129  
130  
131  
132 =head1 SUPPORT
133  
134 You can find documentation for this module with the perldoc command.
135  
136 perldoc IMDB::Local::Rating
137  
138  
139 You can also look for information at:
140  
141 =over 4
142  
143 =item * RT: CPAN's request tracker (report bugs here)
144  
145 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=IMDB-Local>
146  
147 =item * AnnoCPAN: Annotated CPAN documentation
148  
149 L<http://annocpan.org/dist/IMDB-Local>
150  
151 =item * CPAN Ratings
152  
153 L<http://cpanratings.perl.org/d/IMDB-Local>
154  
155 =item * Search CPAN
156  
157 L<http://search.cpan.org/dist/IMDB-Local/>
158  
159 =back
160  
161  
162 =head1 ACKNOWLEDGEMENTS
163  
164  
165 =head1 LICENSE AND COPYRIGHT
166  
167 Copyright 2015 jerryv.
168  
169 This program is free software; you can redistribute it and/or modify it
170 under the terms of the the Artistic License (2.0). You may obtain a
171 copy of the full license at:
172  
173 L<http://www.perlfoundation.org/artistic_license_2_0>
174  
175 Any use, modification, and distribution of the Standard or Modified
176 Versions is governed by this Artistic License. By using, modifying or
177 distributing the Package, you accept this license. Do not use, modify,
178 or distribute the Package, if you do not accept this license.
179  
180 If your Modified Version has been derived from a Modified Version made
181 by someone other than you, you are nevertheless required to ensure that
182 your Modified Version complies with the requirements of this license.
183  
184 This license does not grant you the right to use any trademark, service
185 mark, tradename, or logo of the Copyright Holder.
186  
187 This license includes the non-exclusive, worldwide, free-of-charge
188 patent license to make, have made, use, offer to sell, sell, import and
189 otherwise transfer the Package with respect to any patent claims
190 licensable by the Copyright Holder that are necessarily infringed by the
191 Package. If you institute patent litigation (including a cross-claim or
192 counterclaim) against any party alleging that the Package constitutes
193 direct or contributory patent infringement, then this Artistic License
194 to you shall terminate on the date that such litigation is filed.
195  
196 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
197 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
198 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
199 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
200 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
201 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
202 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
203 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
204  
205  
206 =cut
207  
208 1 1; # End of IMDB::Local::Rating
« lib/IMDB/Local/Plot.pm ↑ Summary lib/IMDB/Local/QualifierType.pm »