| line | stmt | bran | cond | sub | pod | time | code | 
| 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. | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =cut | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | package WebService::IMDB::Name::Stub; | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 2 |  |  | 2 |  | 13 | use strict; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 73 |  | 
| 16 | 2 |  |  | 2 |  | 11 | use warnings; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 90 |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | our $VERSION = '0.05'; | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 2 |  |  | 2 |  | 11 | use base qw(WebService::IMDB::Name); | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 1376 |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 2 |  |  | 2 |  | 14 | use Carp; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 186 |  | 
| 23 |  |  |  |  |  |  | our @CARP_NOT = qw(WebService::IMDB WebService::IMDB::Title); | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 2 |  |  | 2 |  | 14 | use WebService::IMDB::Name; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 23 |  | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | __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 |  |  |  |  |  |  | sub _new { | 
| 50 | 522 |  |  | 522 |  | 685 | my $class = shift; | 
| 51 | 522 |  |  |  |  | 555 | my $ws = shift; | 
| 52 | 522 |  |  |  |  | 553 | my $data = shift; | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 522 |  |  |  |  | 3370 | my $self = $class->SUPER::_new($ws, {'nconst' => $data->{'nconst'}}, '_defer_fetch' => 1); | 
| 55 | 522 |  |  |  |  | 1499 | bless $self, $class; | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 522 |  |  |  |  | 1460 | $self->_stub_nconst($data->{'nconst'}); | 
| 58 | 522 | 100 |  |  |  | 8630 | if (exists $data->{'char'}) { $self->_stub_char($data->{'char'}); } | 
|  | 95 |  |  |  |  | 237 |  | 
| 59 | 522 | 100 |  |  |  | 1842 | if (exists $data->{'image'}) { $self->_stub_image(WebService::IMDB::Image->_new($ws, $data->{'image'})); } | 
|  | 341 |  |  |  |  | 1612 |  | 
| 60 | 522 | 100 |  |  |  | 3951 | if (exists $data->{'name'}) { $self->_stub_name($data->{'name'}); } | 
|  | 427 |  |  |  |  | 1307 |  | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 522 |  |  |  |  | 3950 | if (0) { $self->_check_unparsed($data); } | 
| 63 |  |  |  |  |  |  |  | 
| 64 | 522 |  |  |  |  | 2183 | return $self; | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | sub obj { | 
| 68 | 1 |  |  | 1 | 1 | 16 | my $self = shift; | 
| 69 | 1 |  |  |  |  | 6 | return WebService::IMDB::Name->_new($self->_ws(), {'nconst' => $self->nconst()}); | 
| 70 |  |  |  |  |  |  | } | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | sub nconst { | 
| 74 | 1 |  |  | 1 | 1 | 12 | my $self = shift; | 
| 75 | 1 |  |  |  |  | 6 | return $self->_stub_nconst(); | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | sub char { | 
| 79 | 0 |  |  | 0 | 1 | 0 | my $self = shift; | 
| 80 | 0 |  |  |  |  | 0 | my $nosuper = shift; | 
| 81 |  |  |  |  |  |  |  | 
| 82 | 0 | 0 |  |  |  | 0 | if (defined $self->_stub_char()) { | 
|  |  | 0 |  |  |  |  |  | 
| 83 | 0 |  |  |  |  | 0 | return $self->_stub_char(); | 
| 84 |  |  |  |  |  |  | } elsif ($nosuper) { | 
| 85 | 0 |  |  |  |  | 0 | return undef; | 
| 86 |  |  |  |  |  |  | } else { | 
| 87 | 0 |  |  |  |  | 0 | return $self->SUPER::char(); | 
| 88 |  |  |  |  |  |  | } | 
| 89 |  |  |  |  |  |  | } | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | sub image { | 
| 92 | 1 |  |  | 1 | 1 | 25 | my $self = shift; | 
| 93 | 1 |  |  |  |  | 3 | my $nosuper = shift; | 
| 94 |  |  |  |  |  |  |  | 
| 95 | 1 | 50 |  |  |  | 38 | if (defined $self->_stub_image()) { | 
|  |  | 0 |  |  |  |  |  | 
| 96 | 1 |  |  |  |  | 48 | return $self->_stub_image(); | 
| 97 |  |  |  |  |  |  | } elsif ($nosuper) { | 
| 98 | 0 |  |  |  |  | 0 | return undef; | 
| 99 |  |  |  |  |  |  | } else { | 
| 100 | 0 |  |  |  |  | 0 | return $self->SUPER::image(); | 
| 101 |  |  |  |  |  |  | } | 
| 102 |  |  |  |  |  |  | } | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | sub name { | 
| 105 | 1 |  |  | 1 | 1 | 17 | my $self = shift; | 
| 106 | 1 |  |  |  |  | 2 | my $nosuper = shift; | 
| 107 |  |  |  |  |  |  |  | 
| 108 | 1 | 50 |  |  |  | 6 | if (defined $self->_stub_name()) { | 
|  |  | 0 |  |  |  |  |  | 
| 109 | 1 |  |  |  |  | 14 | return $self->_stub_name(); | 
| 110 |  |  |  |  |  |  | } elsif ($nosuper) { | 
| 111 | 0 |  |  |  |  |  | return undef; | 
| 112 |  |  |  |  |  |  | } else { | 
| 113 | 0 |  |  |  |  |  | return $self->SUPER::name(); | 
| 114 |  |  |  |  |  |  | } | 
| 115 |  |  |  |  |  |  | } | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | sub _check_unparsed { | 
| 119 | 2 |  |  | 2 |  | 1096 | use Storable qw(dclone); | 
|  | 2 |  |  |  |  | 10 |  | 
|  | 2 |  |  |  |  | 323 |  | 
| 120 |  |  |  |  |  |  |  | 
| 121 | 0 |  |  | 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 | 0 |  |  |  |  | if (scalar keys %$d != 0) { | 
| 129 | 0 |  |  |  |  |  | die "Remaining keys: " . join(", ", keys %$d); | 
| 130 |  |  |  |  |  |  | } | 
| 131 |  |  |  |  |  |  | } | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | 1; |