Amazon/Item.pm

filter: Statementstmt 20.7% 16 / 77 Branchbran 0.0% 0 / 28 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 26.3% 5 / 19 Podpod 100% 14 / 14 totaltotal 25.3% 35 / 138 SCAR 50.2
CC
15
Cov
15%
made_by
42.0
creators_all
20.0
image
20.0
CRAP 152.0
« Amazon.pm ↑ Summary Amazon/Collection.pm »
1 package XML::Amazon::Item;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use LWP::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use XML::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub new {
11 0 ▶ my($pkg, %options) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
12  
13 bless {
14 title => $options{'title'},
15 authors => $options{'authors'},
16 artists => $options{'artists'},
17 creators => $options{'creators'},
18 directors => $options{'directors'},
19 actors => $options{'actors'},
20 type => $options{'type'},
21 url => $options{'url'},
22 smallimage => $options{'smallimage'},
23 mediumimage => $options{'mediumimage'},
24 largeimage => $options{'largeimage'},
25 publisher => $options{'publisher'},
26 0 price => $options{'price'},
27 }, $pkg;
28 }
29  
30 sub creators_all {
31 0 ▶ my $self = shift;
Subroutine creators_all: not called CC=4 SCAR=30.0
Pod documented
32 0 my @list;
33 0 ▶ for (my $i; $self->{authors}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"authors"}[$i]) 0 0 0
34 0 push @list, $self->{authors}->[$i];
35 }
36 0 ▶ for (my $i; $self->{artists}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"artists"}[$i]) 0 0 0
37 0 push @list, $self->{artists}->[$i];
38 }
39 0 ▶ for (my $i; $self->{creators}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"creators"}[$i]) 0 0 0
40 0 push @list, $self->{creators}->[$i];
41 }
42 0 return @list;
43 }
44  
45 sub made_by {
46 0 ▶ my $self = shift;
Subroutine made_by: not called CC=6 SCAR=37.4
Pod documented
47 0 my @list;
48 0 ▶ for (my $i; $self->{authors}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"authors"}[$i]) 0 0 0
49 0 push @list, $self->{authors}->[$i];
50 }
51 0 ▶ for (my $i; $self->{artists}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"artists"}[$i]) 0 0 0
52 0 push @list, $self->{artists}->[$i];
53 }
54  
55 0 ▶ for (my $i; $self->{creators}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"creators"}[$i]) 0 0 0
56 0 push @list, $self->{creators}->[$i];
57 }
58  
59 0 ▶ for (my $i; $self->{directors}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"directors"}[$i]) 0 0 0
60 0 push @list, $self->{directors}->[$i];
61 }
62  
63 0 ▶ for (my $i; $self->{actors}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"actors"}[$i]) 0 0 0
64 0 push @list, $self->{actors}->[$i];
65 }
66  
67  
68 0 my %tmp;
69 0 @list = grep( !$tmp{$_}++, @list );
70  
71 0 return @list;
72 }
73  
74 sub authors {
75 0 ▶ my $self = shift;
Subroutine authors: not called CC=2 SCAR=17.9
Pod documented
76 0 my @list;
77 0 ▶ for (my $i; $self->{authors}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"authors"}[$i]) 0 0 0
78 0 push @list, $self->{authors}->[$i];
79 }
80 0 return @list;
81 }
82  
83 sub artists {
84 0 ▶ my $self = shift;
Subroutine artists: not called CC=2 SCAR=17.9
Pod documented
85 0 my @list;
86 0 ▶ for (my $i; $self->{artists}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"artists"}[$i]) 0 0 0
87 0 push @list, $self->{artists}->[$i];
88 }
89 0 return @list;
90 }
91  
92 sub creators {
93 0 ▶ my $self = shift;
Subroutine creators: not called CC=2 SCAR=17.9
Pod documented
94 0 my @list;
95 0 ▶ for (my $i; $self->{creators}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"creators"}[$i]) 0 0 0
96 0 push @list, $self->{creators}->[$i];
97 }
98 0 return @list;
99 }
100  
101 sub publisher {
102 0 ▶ my $self = shift;
Subroutine publisher: not called CC=1 SCAR=6.9
Pod documented
103 0 return $self->{publisher};
104 }
105  
106 sub asin {
107 0 ▶ my $self = shift;
Subroutine asin: not called CC=1 SCAR=6.9
Pod documented
108 0 return $self->{asin};
109 }
110  
111 sub title {
112 0 ▶ my $self = shift;
Subroutine title: not called CC=1 SCAR=6.9
Pod documented
113 0 return $self->{title};
114 }
115  
116 sub author {
117 0 ▶ my $self = shift;
Subroutine author: not called CC=1 SCAR=6.9
Pod documented
118 0 return @{$self->authors}[0];
119 }
120  
121 sub image {
122 0 ▶ my $self = shift;
Subroutine image: not called CC=4 SCAR=30.0
Pod documented
123 0 my $size = shift;
124  
125 0 ▶ return $self->{smallimage} if $size eq 's';
Branch: 1 branch
BranchTrueFalseTotal
if $size eq "s" 0 0 0
126 0 ▶ return $self->{mediumimage} if $size eq 'm';
Branch: 1 branch
BranchTrueFalseTotal
if $size eq "m" 0 0 0
127 0 ▶ return $self->{largeimage} if $size eq 'l';
Branch: 1 branch
BranchTrueFalseTotal
if $size eq "l" 0 0 0
128  
129 }
130  
131 sub url {
132 0 ▶ my $self = shift;
Subroutine url: not called CC=1 SCAR=6.9
Pod documented
133 0 return $self->{url};
134 }
135  
136 sub type {
137 0 ▶ my $self = shift;
Subroutine type: not called CC=1 SCAR=6.9
Pod documented
138 0 return $self->{type};
139 }
140  
141 sub price {
142 0 ▶ my $self = shift;
Subroutine price: not called CC=1 SCAR=6.9
Pod documented
143 0 return $self->{price};
144 }
145  
146 4 1;
147  
148 __END__
« Amazon.pm ↑ Summary Amazon/Collection.pm »