IMDB/Name/Stub.pm

filter: Statementstmt 33.8% 22 / 65 Branchbran 0.0% 0 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 46.1% 6 / 13 Podpod 100% 5 / 5 totaltotal 32.0% 33 / 103 CC 11 SCAR 21.9
CC
11
Cov
26%
_new
20.0
char
12.0
image
12.0
CRAP 8.9
« IMDB/DatePlace.pm ↑ Summary IMDB/Name.pm »
1 # $Id: Stub.pm 7370 2012-04-09 01:17:33Z chris $
2  
3 =head1 NAME
4  
5 WebService::IMDB::Name::Stub
6  
7 =head1 DESCRIPTION
8  
9 For details, see L<WebService::IMDB::Title::Stub>.
10  
11 =cut
12  
13 package WebService::IMDB::Name::Stub;
14  
15 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 our $VERSION = '0.05';
19  
20 2 ▶use base qw(WebService::IMDB::Name);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 our @CARP_NOT = qw(WebService::IMDB WebService::IMDB::Title);
24  
25 2 ▶use WebService::IMDB::Name;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 2 __PACKAGE__->mk_accessors(qw(
28 _stub_nconst
29 _stub_char
30 _stub_image
31 _stub_name
32 ));
33  
34  
35 =head1 METHODS
36  
37 =head2 obj
38  
39 =head2 nconst
40  
41 =head2 char
42  
43 =head2 image
44  
45 =head2 name
46  
47 =cut
48  
49 0 ▶sub _new {
Subroutine _new: not called CC=4 SCAR=30.0
50 0 my $class = shift;
51 0 my $ws = shift;
52 0 my $data = shift;
53  
54 0 my $self = $class->SUPER::_new($ws, {'nconst' => $data->{'nconst'}}, '_defer_fetch' => 1);
55 0 bless $self, $class;
56  
57 0 $self->_stub_nconst($data->{'nconst'});
58 0 ▶ if (exists $data->{'char'}) { $self->_stub_char($data->{'char'}); }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $data->{"char"}) 0 0 0
59 0 ▶ if (exists $data->{'image'}) { $self->_stub_image(WebService::IMDB::Image->_new($ws, $data->{'image'})); }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $data->{"image"}) 0 0 0
60 0 ▶ if (exists $data->{'name'}) { $self->_stub_name($data->{'name'}); }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $data->{"name"}) 0 0 0
61  
62 0 if (0) { $self->_check_unparsed($data); }
63  
64 0 return $self;
65 }
66  
67 0 ▶sub obj {
Subroutine obj: not called CC=1 SCAR=6.9
Pod documented
68 0 my $self = shift;
69 0 return WebService::IMDB::Name->_new($self->_ws(), {'nconst' => $self->nconst()});
70 }
71  
72  
73 0 ▶sub nconst {
Subroutine nconst: not called CC=1 SCAR=6.9
Pod documented
74 0 my $self = shift;
75 0 return $self->_stub_nconst();
76 }
77  
78 0 ▶sub char {
Subroutine char: not called CC=3 SCAR=24.8
Pod documented
79 0 my $self = shift;
80 0 my $nosuper = shift;
81  
82 0 ▶ if (defined $self->_stub_char()) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->_stub_char) { } 0 0 0
elsif ($nosuper) { } 0 0 0
83 0 return $self->_stub_char();
84 } elsif ($nosuper) {
85 0 return undef;
86 } else {
87 0 return $self->SUPER::char();
88 }
89 }
90  
91 0 ▶sub image {
Subroutine image: not called CC=3 SCAR=24.8
Pod documented
92 0 my $self = shift;
93 0 my $nosuper = shift;
94  
95 0 ▶ if (defined $self->_stub_image()) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->_stub_image) { } 0 0 0
elsif ($nosuper) { } 0 0 0
96 0 return $self->_stub_image();
97 } elsif ($nosuper) {
98 0 return undef;
99 } else {
100 0 return $self->SUPER::image();
101 }
102 }
103  
104 0 ▶sub name {
Subroutine name: not called CC=3 SCAR=24.8
Pod documented
105 0 my $self = shift;
106 0 my $nosuper = shift;
107  
108 0 ▶ if (defined $self->_stub_name()) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $self->_stub_name) { } 0 0 0
elsif ($nosuper) { } 0 0 0
109 0 return $self->_stub_name();
110 } elsif ($nosuper) {
111 0 return undef;
112 } else {
113 0 return $self->SUPER::name();
114 }
115 }
116  
117  
118 0 ▶sub _check_unparsed {
Subroutine _check_unparsed: not called CC=2 SCAR=13.0
119 2 ▶ use Storable qw(dclone);
Subroutine BEGIN: called CC=1 SCAR=0.0
120  
121 0 my $self = shift;
122 0 my $d = dclone(shift);
123  
124 0 delete $d->{'nconst'};
125 0 delete $d->{'image'};
126 0 delete $d->{'name'};
127  
128 0 ▶ if (scalar keys %$d != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %$d != 0) 0 0 0
129 0 die "Remaining keys: " . join(", ", keys %$d);
130 }
131 }
132  
133 2 1;
« IMDB/DatePlace.pm ↑ Summary IMDB/Name.pm »