File Coverage

blib/lib/XML/Amazon/Item.pm
Criterion Covered Total %
statement 9 70 12.8
branch 0 6 0.0
condition n/a
subroutine 3 17 17.6
pod 14 14 100.0
total 26 107 24.3


line stmt bran cond sub pod time code
1             package XML::Amazon::Item;
2             $XML::Amazon::Item::VERSION = '0.14';
3 1     1   8 use strict;
  1         2  
  1         30  
4 1     1   5 use warnings;
  1         2  
  1         27  
5 1     1   6 use utf8;
  1         2  
  1         6  
6              
7             sub new {
8 0     0 1   my($pkg, %options) = @_;
9              
10             bless {
11             title => $options{'title'},
12             authors => $options{'authors'},
13             artists => $options{'artists'},
14             creators => $options{'creators'},
15             directors => $options{'directors'},
16             actors => $options{'actors'},
17             type => $options{'type'},
18             url => $options{'url'},
19             smallimage => $options{'smallimage'},
20             mediumimage => $options{'mediumimage'},
21             largeimage => $options{'largeimage'},
22             publisher => $options{'publisher'},
23 0           price => $options{'price'},
24             }, $pkg;
25             }
26              
27             sub creators_all {
28 0     0 1   my $self = shift;
29 0           my @list;
30 0           for (my $i; $self->{authors}->[$i]; $i++){
31 0           push @list, $self->{authors}->[$i];
32             }
33 0           for (my $i; $self->{artists}->[$i]; $i++){
34 0           push @list, $self->{artists}->[$i];
35             }
36 0           for (my $i; $self->{creators}->[$i]; $i++){
37 0           push @list, $self->{creators}->[$i];
38             }
39 0           return @list;
40             }
41              
42             sub made_by {
43 0     0 1   my $self = shift;
44 0           my @list;
45 0           for (my $i; $self->{authors}->[$i]; $i++){
46 0           push @list, $self->{authors}->[$i];
47             }
48 0           for (my $i; $self->{artists}->[$i]; $i++){
49 0           push @list, $self->{artists}->[$i];
50             }
51              
52 0           for (my $i; $self->{creators}->[$i]; $i++){
53 0           push @list, $self->{creators}->[$i];
54             }
55              
56 0           for (my $i; $self->{directors}->[$i]; $i++){
57 0           push @list, $self->{directors}->[$i];
58             }
59              
60 0           for (my $i; $self->{actors}->[$i]; $i++){
61 0           push @list, $self->{actors}->[$i];
62             }
63              
64              
65 0           my %tmp;
66 0           @list = grep( !$tmp{$_}++, @list );
67              
68 0           return @list;
69             }
70              
71             sub authors {
72 0     0 1   my $self = shift;
73 0           my @list;
74 0           for (my $i; $self->{authors}->[$i]; $i++){
75 0           push @list, $self->{authors}->[$i];
76             }
77 0           return @list;
78             }
79              
80             sub artists {
81 0     0 1   my $self = shift;
82 0           my @list;
83 0           for (my $i; $self->{artists}->[$i]; $i++){
84 0           push @list, $self->{artists}->[$i];
85             }
86 0           return @list;
87             }
88              
89             sub creators {
90 0     0 1   my $self = shift;
91 0           my @list;
92 0           for (my $i; $self->{creators}->[$i]; $i++){
93 0           push @list, $self->{creators}->[$i];
94             }
95 0           return @list;
96             }
97              
98             sub publisher {
99 0     0 1   my $self = shift;
100 0           return $self->{publisher};
101             }
102              
103             sub asin {
104 0     0 1   my $self = shift;
105 0           return $self->{asin};
106             }
107              
108             sub title {
109 0     0 1   my $self = shift;
110 0           return $self->{title};
111             }
112              
113             sub author {
114 0     0 1   my $self = shift;
115 0           return @{$self->authors}[0];
  0            
116             }
117              
118             sub image {
119 0     0 1   my $self = shift;
120 0           my $size = shift;
121              
122 0 0         return $self->{smallimage} if $size eq 's';
123 0 0         return $self->{mediumimage} if $size eq 'm';
124 0 0         return $self->{largeimage} if $size eq 'l';
125              
126             }
127              
128             sub url {
129 0     0 1   my $self = shift;
130 0           return $self->{url};
131             }
132              
133             sub type {
134 0     0 1   my $self = shift;
135 0           return $self->{type};
136             }
137              
138             sub price {
139 0     0 1   my $self = shift;
140 0           return $self->{price};
141             }
142              
143             1;
144              
145             __END__