File Coverage

blib/lib/WebService/IMDB/Runtime.pm
Criterion Covered Total %
statement 17 18 94.4
branch 2 4 50.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 24 27 88.8


line stmt bran cond sub pod time code
1             # $Id: Runtime.pm 7370 2012-04-09 01:17:33Z chris $
2              
3             =head1 NAME
4              
5             WebService::IMDB::Runtime
6              
7             =cut
8              
9             package WebService::IMDB::Runtime;
10              
11 2     2   10 use strict;
  2         6  
  2         63  
12 2     2   10 use warnings;
  2         3  
  2         74  
13              
14             our $VERSION = '0.05';
15              
16 2     2   9 use Carp;
  2         4  
  2         140  
17             our @CARP_NOT = qw(WebService::IMDB WebService::IMDB::Title);
18              
19 2     2   12 use DateTime::Duration;
  2         3  
  2         247  
20              
21              
22             sub _new {
23 1     1   4 my $class = shift;
24 1         2 my $ws = shift;
25 1 50       5 my $data = shift or die;
26              
27 1 50       16 if (exists $data->{'time'}) {
28 1         16 return DateTime::Duration->new('seconds' => $data->{'time'});
29              
30             } else {
31 0           croak "Unable to parse runtime";
32             }
33             }
34              
35             1;