File Coverage

blib/lib/IMDB/Local/Plot.pm
Criterion Covered Total %
statement 27 53 50.9
branch 0 10 0.0
condition n/a
subroutine 9 14 64.2
pod 0 5 0.0
total 36 82 43.9


line stmt bran cond sub pod time code
1             package IMDB::Local::Plot;
2              
3 1     1   12 use 5.006;
  1         2  
  1         26  
4 1     1   5 use strict;
  1         2  
  1         31  
5 1     1   5 use warnings;
  1         2  
  1         86  
6              
7             =head1 NAME
8              
9             IMDB::Local::Plot - Object representation of Plot information.
10              
11             =head1 VERSION
12              
13             Version 0.01
14              
15             =cut
16              
17             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::Plot;
26              
27             my $foo = IMDB::Local::Plot->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     1   4 use IMDB::Local::DB::BaseObject;
  1         2  
  1         4  
42 1     1   20 use base qw(IMDB::Local::DB::BaseObject);
  1         0  
  1         61  
43              
44 1     1   4 use constant DB_TABLE => 'Plots';
  1         0  
  1         38  
45 1     1   3 use constant DB_KEY => 'PlotID';
  1         2  
  1         50  
46              
47             use Class::MethodMaker
48             [
49 1         6 scalar => [DB_KEY],
50             array => [qw/ -static db_columns/],
51             new => [qw/ -init -hash new/] ,
52 1     1   4 ];
  1         1  
53              
54             sub init($)
55             {
56 0     0 0   my ($self)=@_;
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 0         if ( $self->populateUsingKey($self->get(DB_KEY)) ) {
66 0           return $self;
67             }
68 0           return(undef);
69             }
70              
71 1     1   1003 use Carp;
  1         2  
  1         336  
72              
73             sub createNew($%)
74             {
75 0     0 0   my ($imdbdb, %args)=@_;
76              
77 0 0         carp("no name given") if ( !defined($args{name}) );
78              
79 0           my $id=$imdbdb->insert_db(DB_TABLE, DB_KEY, %args);
80 0 0         if ( !defined($id) ) {
81 0           return(undef);
82             }
83 0           return new IMDB::Local::Plot(imdbdb=>$imdbdb, TableID=>$id);
84             }
85              
86             sub findByPlotID($$)
87             {
88 0     0 0   my ($imdbdb, $id)=@_;
89 0           return new IMDB::Local::Plot(imdbdb=>$imdbdb, DB_KEY, $id);
90             }
91              
92             sub findByName($$)
93             {
94 0     0 0   my ($imdbdb, $name)=@_;
95              
96 0           my $id=$imdbdb->select2Scalar("SELECT ".DB_KEY." from ".DB_TABLE." where name='$name'");
97 0 0         if ( defined($id) ) {
98 0           return new IMDB::Local::Plot(imdbdb=>$imdbdb, DB_KEY, $id);
99             }
100 0           return(undef);
101             }
102              
103             sub getIDs($$)
104             {
105 0     0 0   my ($class, $imdbdb)=@_;
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 0         if ( !defined($res) ) {
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<< >>
122              
123             =head1 BUGS
124              
125             Please report any bugs or feature requests to C, or through
126             the web interface at L. 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::Plot
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
146              
147             =item * AnnoCPAN: Annotated CPAN documentation
148              
149             L
150              
151             =item * CPAN Ratings
152              
153             L
154              
155             =item * Search CPAN
156              
157             L
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
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; # End of IMDB::Local::Plot