| 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
| |||||||||||||||
| 59 | 0 | ▶ | if (exists $data->{'image'}) { $self->_stub_image(WebService::IMDB::Image->_new($ws, $data->{'image'})); } | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 60 | 0 | ▶ | if (exists $data->{'name'}) { $self->_stub_name($data->{'name'}); } | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 129 | 0 | die "Remaining keys: " . join(", ", keys %$d); | |||||||||||||
| 130 | } | ||||||||||||||
| 131 | } | ||||||||||||||
| 132 | |||||||||||||||
| 133 | 2 | 1; | |||||||||||||