| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WebService::Aladdin::Item::DVD; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 10 | use strict; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 63 |  | 
| 4 | 2 |  |  | 2 |  | 11 | use warnings; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 58 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 2 |  |  | 2 |  | 9 | use base qw(WebService::Aladdin::Item); | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 12 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | __PACKAGE__->mk_accessors(qw/dvdinfo/); | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub init { | 
| 11 | 0 |  |  | 0 | 0 |  | my ($self, $info) = @_; | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 0 |  |  |  |  |  | my $data; | 
| 14 | 0 |  |  |  |  |  | foreach my $key (keys %{ $info }) { | 
|  | 0 |  |  |  |  |  |  | 
| 15 | 0 |  |  |  |  |  | my $type = $key; | 
| 16 | 0 |  |  |  |  |  | $type =~ s/^aladdin://; | 
| 17 | 0 | 0 | 0 |  |  |  | if ($type eq 'authors' && $info->{'aladdin:authors'}) { | 
| 18 | 0 |  |  |  |  |  | my $author = $info->{'aladdin:authors'}->{'aladdin:author'}; | 
| 19 | 0 | 0 |  |  |  |  | if (ref($author) eq 'HASH') { | 
|  |  | 0 |  |  |  |  |  | 
| 20 | 0 |  |  |  |  |  | $data->{'author'} = { | 
| 21 |  |  |  |  |  |  | authorid   => $author->{'-authorid'}, | 
| 22 |  |  |  |  |  |  | authorType => $author->{'authorType'}, | 
| 23 |  |  |  |  |  |  | text       => $author->{'#text'}, | 
| 24 |  |  |  |  |  |  | desc       => $author->{'-desc'}, | 
| 25 |  |  |  |  |  |  | }; | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  | elsif (ref($author) eq 'ARRAY') { | 
| 28 | 0 |  |  |  |  |  | foreach my $p (@{ $info->{'aladdin:authors'}->{'aladdin:author'} }) { | 
|  | 0 |  |  |  |  |  |  | 
| 29 | 0 |  |  |  |  |  | unshift @{ $data->{$type} }, { | 
|  | 0 |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | authorid => $p->{'-authorid'}, | 
| 31 |  |  |  |  |  |  | authorType => $p->{'-authorType'}, | 
| 32 |  |  |  |  |  |  | text       => $p->{'#text'}, | 
| 33 |  |  |  |  |  |  | desc       => $p->{'-desc'}, | 
| 34 |  |  |  |  |  |  | }; | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  | else { | 
| 39 | 0 |  |  |  |  |  | $data->{$type} = $info->{$key}; | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  | } | 
| 42 | 0 |  |  |  |  |  | $self->dvdinfo($data); | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | 1; |