File Coverage

blib/lib/IMDB/Local/QualifierType.pm
Criterion Covered Total %
statement 54 83 65.0
branch 0 10 0.0
condition n/a
subroutine 18 24 75.0
pod 0 6 0.0
total 72 123 58.5


line stmt bran cond sub pod time code
1             package IMDB::Local::QualifierType;
2              
3 1     1   20 use 5.006;
  1         4  
  1         40  
4 1     1   7 use strict;
  1         1  
  1         22  
5 1     1   3 use warnings;
  1         2  
  1         33  
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             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     1   298 use IMDB::Local::DB::BaseObject;
  1         2  
  1         10  
31 1     1   30 use base qw(IMDB::Local::DB::BaseObject);
  1         2  
  1         60  
32              
33 1     1   4 use constant DB_TABLE => 'QualifierTypes';
  1         1  
  1         55  
34 1     1   4 use constant DB_KEY => 'QualifierTypeID';
  1         1  
  1         44  
35              
36             use Class::MethodMaker
37             [
38 1         5 scalar => [DB_KEY],
39             array => [qw/ -static db_columns/],
40             new => [qw/ -init -hash new/] ,
41 1     1   4 ];
  1         1  
42              
43             sub init($)
44             {
45 0     0 0   my ($self)=@_;
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 0         if ( $self->populateUsingKey($self->get(DB_KEY)) ) {
55 0           return $self;
56             }
57 0           return(undef);
58             }
59              
60 1     1   2605 use constant TV_MOVIE => 1;
  1         2  
  1         36  
61 1     1   4 use constant TV_MINI_SERIES => 2;
  1         2  
  1         40  
62 1     1   4 use constant TV_SERIES => 3;
  1         1  
  1         34  
63 1     1   3 use constant VIDEO_MOVIE => 4;
  1         1  
  1         27  
64 1     1   3 use constant VIDEO_GAME => 5;
  1         1  
  1         29  
65 1     1   3 use constant MOVIE => 6;
  1         1  
  1         28  
66              
67 1     1   3 use constant EPISODE_OF_TV_MINI_SERIES => 12;
  1         1  
  1         32  
68 1     1   3 use constant EPISODE_OF_TV_SERIES => 13;
  1         1  
  1         53  
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             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     1   4 use Carp;
  1         2  
  1         234  
77              
78             sub createNew($%)
79             {
80 0     0 0   my ($imdbdb, %args)=@_;
81              
82 0 0         carp("no name given") if ( !defined($args{name}) );
83              
84 0           my $id=$imdbdb->insert_db(DB_TABLE, DB_KEY, %args);
85 0 0         if ( !defined($id) ) {
86 0           return(undef);
87             }
88 0           return new IMDB::Local::QualifierType(imdbdb=>$imdbdb, TableID=>$id);
89             }
90              
91             sub findByQualifierTypeID($$)
92             {
93 0     0 0   my ($imdbdb, $id)=@_;
94 0           return new IMDB::Local::QualifierType(imdbdb=>$imdbdb, DB_KEY, $id);
95             }
96              
97             sub findByName($$)
98             {
99 0     0 0   my ($imdbdb, $name)=@_;
100              
101 0           my $id=$imdbdb->select2Scalar("SELECT ".DB_KEY." from ".DB_TABLE." where name='$name'");
102 0 0         if ( defined($id) ) {
103 0           return new IMDB::Local::QualifierType(imdbdb=>$imdbdb, DB_KEY, $id);
104             }
105 0           return(undef);
106             }
107              
108 1     1   5 use IMDB::Local::QualifierType;
  1         2  
  1         9  
109              
110             sub populateQualifierType($)
111             {
112 0     0 0   my ($self)=@_;
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     0 0   my ($class, $imdbdb)=@_;
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 0         if ( !defined($res) ) {
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<< >>
137              
138             =head1 BUGS
139              
140             Please report any bugs or feature requests to C, or through
141             the web interface at L. 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
159              
160             =item * AnnoCPAN: Annotated CPAN documentation
161              
162             L
163              
164             =item * CPAN Ratings
165              
166             L
167              
168             =item * Search CPAN
169              
170             L
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
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; # End of IMDB::Local::QualifierType