lib/IMDB/Local/QualifierType.pm

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