Amazon/Item.pm

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