MoviePosterDB/Movie.pm

filter: Statementstmt 47.5% 19 / 40 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 100% 2 / 2 totaltotal 50.0% 26 / 52 CC 2 SCAR 8.5
CC
2
Cov
45%
_new
6.0
tconst
2.0
imdbid
2.0
CRAP 2.3
« MoviePosterDB.pm ↑ Summary MoviePosterDB/Poster.pm »
1 # $Id: Movie.pm 6486 2011-06-13 13:42:02Z chris $
2  
3 =head1 NAME
4  
5 WebService::MoviePosterDB::Movie
6  
7 =head1 SYNOPSIS
8  
9 =head1 DESCRIPTION
10  
11 =cut
12  
13 package WebService::MoviePosterDB::Movie;
14  
15 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 our $VERSION = '0.18';
19  
20 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 our @CARP_NOT = qw(WebService::MoviePosterDB);
22  
23 1 ▶use base qw(Class::Accessor);
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 __PACKAGE__->mk_accessors(qw(
26 imdb
27 title
28 year
29 page
30 posters
31 ));
32  
33 1 ▶use WebService::MoviePosterDB::Poster;
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 0 ▶sub _new {
Subroutine _new: not called CC=2 SCAR=17.9
36 0 my $class = shift;
37 0 my $json = shift;
38 0 my $self = {};
39  
40 0 ▶ if (defined $json->{'errors'}) { croak join("; ", map {s/\.*$//; $_} @{$json->{'errors'}}); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $json->{"errors"}) 0 0 0
41  
42 0 bless $self, $class;
43  
44 0 $self->imdb($json->{'imdb'});
45 0 $self->title($json->{'title'});
46 0 $self->year($json->{'year'});
47 0 $self->page($json->{'page'});
48 0 $self->posters( [ map { WebService::MoviePosterDB::Poster->_new($_) } @{$json->{'posters'}} ] );
49  
50 0 return $self;
51 }
52  
53 =head1 METHODS
54  
55 =head2 tconst()
56  
57 =cut
58  
59 0 ▶sub tconst {
Subroutine tconst: not called CC=1 SCAR=6.9
Pod documented
60 0 my $self = shift;
61 0 return sprintf("tt%07d", $self->imdb());
62 }
63  
64 =head2 imdbid()
65  
66 =cut
67  
68 0 ▶sub imdbid {
Subroutine imdbid: not called CC=1 SCAR=6.9
Pod documented
69 0 my $self = shift;
70 0 return $self->tconst();
71 }
72  
73 =head2 imdb()
74  
75 =head2 title()
76  
77 =head2 year()
78  
79 =head2 page()
80  
81 =head2 posters()
82  
83 =cut
84  
85 1 1;
« MoviePosterDB.pm ↑ Summary MoviePosterDB/Poster.pm »