File Coverage

blib/lib/WebService/IMDB/QuoteLine.pm
Criterion Covered Total %
statement 30 30 100.0
branch 7 8 87.5
condition n/a
subroutine 6 6 100.0
pod n/a
total 43 44 97.7


line stmt bran cond sub pod time code
1             # $Id: QuoteLine.pm 7370 2012-04-09 01:17:33Z chris $
2              
3             =head1 NAME
4              
5             WebService::IMDB::QuoteLine
6              
7             =cut
8              
9             package WebService::IMDB::QuoteLine;
10              
11 2     2   10 use strict;
  2         5  
  2         65  
12 2     2   11 use warnings;
  2         5  
  2         86  
13              
14             our $VERSION = '0.05';
15              
16 2     2   11 use base qw(Class::Accessor);
  2         4  
  2         249  
17              
18 2     2   13 use Carp;
  2         4  
  2         177  
19             our @CARP_NOT = qw(WebService::IMDB WebService::IMDB::Title);
20              
21 2     2   1214 use WebService::IMDB::Char;
  2         7  
  2         23  
22              
23             __PACKAGE__->mk_accessors(qw(
24             chars
25             quote
26             stage
27             ));
28              
29              
30             =head1 METHODS
31              
32             =head2 chars
33              
34             =head2 quote
35              
36             =head2 stage
37              
38             =cut
39              
40             sub _new {
41 112     112   127 my $class = shift;
42 112         115 my $ws = shift;
43 112 50       194 my $data = shift or die;
44              
45 112         154 my $self = {};
46              
47 112         218 bless $self, $class;
48              
49 112 100       222 if (exists $data->{'chars'}) {
50             # TODO: Some entries don't have an nconst. Need to decide whether to handle these differently.
51 102         109 $self->chars( [ map { WebService::IMDB::Char->_new($ws, $_) } @{$data->{'chars'}} ] );
  102         325  
  102         190  
52             } else {
53 10         29 $self->chars([]);
54             }
55 112 100       1075 if (exists $data->{'quote'}) { $self->quote($data->{'quote'}); }
  102         245  
56 112 100       945 if (exists $data->{'stage'}) { $self->stage($data->{'stage'}); }
  19         50  
57              
58 112         502 return $self;
59             }
60              
61             1;