Aladdin/Item/Book.pm

filter: Statementstmt 40.7% 11 / 27 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 36.8% 14 / 38 CC 6 SCAR 33.4
CC
6
Cov
33%
init
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 28.3
« Aladdin/Item/Music.pm ↑ Summary Aladdin/Parser.pm »
1 package WebService::Aladdin::Item::Book;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use base qw(WebService::Aladdin::Item);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 __PACKAGE__->mk_accessors(qw/bookinfo/);
9  
10 0 ▶sub init {
Subroutine init: not called CC=6 SCAR=37.4
Pod undocumented
11 0 my ($self, $info) = @_;
12  
13 0 my $data;
14 0 foreach my $key (keys %{ $info }) {
15 0 my $type = $key;
16 0 $type =~ s/^aladdin://;
17 0 ▶ if ($type eq 'authors') {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq 'authors') { } 0 0 0
18 0 my $author = $info->{'aladdin:authors'}->{'aladdin:author'};
19 0 ▶ if (ref($author) eq 'HASH') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $author eq 'HASH') { } 0 0 0
elsif (ref $author eq 'ARRAY') { } 0 0 0
20 $data->{author} = {
21 authorid => $author->{'-authorid'},
22 authorType => $author->{'-authorType'},
23 text => $author->{'#text'},
24 0 desc => $author->{'-desc'},
25 };
26 }
27 elsif (ref($author) eq 'ARRAY') {
28 0 foreach my $p (@{ $info->{'aladdin:authors'}->{'aladdin:author'} }) {
29 0 unshift @{ $data->{$type} }, {
30 authorid => $p->{'-authorid'},
31 authorType => $p->{'-authorType'},
32 text => $p->{'#text'},
33 0 desc => $p->{'-desc'},
34 };
35 }
36 }
37 }
38 else {
39 0 $data->{$type} = $info->{$key};
40 }
41 }
42 0 $self->bookinfo($data);
43 }
44  
45 2 1;
« Aladdin/Item/Music.pm ↑ Summary Aladdin/Parser.pm »