IMDB/NewsItem.pm

filter: Statementstmt 53.1% 25 / 47 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod n/a totaltotal 50.7% 32 / 63 CC 5 SCAR 25.7
CC
5
Cov
45%
_new
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 13.1
« IMDB/Title/Stub.pm ↑ Summary IMDB/Certificate.pm »
1 # $Id: NewsItem.pm 7370 2012-04-09 01:17:33Z chris $
2  
3 =head1 NAME
4  
5 WebService::IMDB::NewsItem
6  
7 =cut
8  
9 package WebService::IMDB::NewsItem;
10  
11 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 our $VERSION = '0.05';
15  
16 2 ▶use base qw(Class::Accessor);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 our @CARP_NOT = qw(WebService::IMDB WebService::IMDB::Name WebService::IMDB::News);
20  
21 2 ▶use DateTime::Format::Strptime;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 2 ▶use WebService::IMDB::Name::Stub;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use WebService::IMDB::Title::Stub;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 2 __PACKAGE__->mk_accessors(qw(
27 id
28 body
29 datetime
30 head
31 icon
32 link
33 names
34 source
35 titles
36 ));
37  
38  
39 =head1 METHODS
40  
41 =head2 id
42  
43 =head2 body
44  
45 =head2 datetime
46  
47 =head2 head
48  
49 =head2 icon
50  
51 =head2 link
52  
53 =head2 names
54  
55 =head2 sources
56  
57 =head2 titles
58  
59 =cut
60  
61 0 ▶sub _new {
Subroutine _new: not called CC=5 SCAR=34.0
62 0 my $class = shift;
63 0 my $ws = shift;
64 0 ▶ my $data = shift or die;
Branch: 1 branch
BranchTrueFalseTotal
my $data = shift() or die 0 0 0
65 0 ▶ my $sources = shift or die;
Branch: 1 branch
BranchTrueFalseTotal
my $sources = shift() or die 0 0 0
66  
67 0 my $self = {};
68  
69 0 bless $self, $class;
70  
71 0 $self->id($data->{'id'});
72 0 $self->body($data->{'body'});
73 0 $self->datetime(DateTime::Format::Strptime->new('pattern' => "%Y-%m-%dT%H:%M:%SZ", 'on_error' => "croak")->parse_datetime($data->{'datetime'})); # TODO: Handle timezone other than Z (i.e. UTC)
74 0 $self->head($data->{'head'});
75 0 ▶ if (exists $data->{'icon'}) { $self->icon($data->{'icon'}); }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $data->{"icon"}) 0 0 0
76 0 ▶ if (exists $data->{'link'}) { $self->link($data->{'link'}); }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $data->{"link"}) 0 0 0
77 0 $self->names( [ map { WebService::IMDB::Name::Stub->_new($ws, $_) } @{$data->{'names'}} ] );
78 0 $self->source($sources->{$data->{'source'}});
79 0 $self->titles( [ map { WebService::IMDB::Title::Stub->_new($ws, $_) } @{$data->{'titles'}} ] );
80  
81 0 return $self;
82 }
83  
84 2 1;
« IMDB/Title/Stub.pm ↑ Summary IMDB/Certificate.pm »