| 1 | ############################################# | ||||||||||||||||||||||||||||
| 2 | package Net::Amazon::Response::Seller; | ||||||||||||||||||||||||||||
| 3 | ############################################# | ||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use base qw(Net::Amazon::Response); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Net::Amazon::Result::Seller; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Log::Log4perl qw(:easy); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | ############################## | ||||||||||||||||||||||||||||
| 11 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | ############################## | ||||||||||||||||||||||||||||
| 13 | 1 | my($class, %options) = @_; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | my $self = $class->SUPER::new(%options); | |||||||||||||||||||||||||||
| 16 | 1 | bless $self, $class; # reconsecrate | |||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | ################################################## | ||||||||||||||||||||||||||||
| 20 | 6 | ▶ | sub result { | ||||||||||||||||||||||||||
|
Subroutine
result: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 21 | ################################################## | ||||||||||||||||||||||||||||
| 22 | 6 | my($self) = @_; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 6 | ▶ | if($self->is_success()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 6 | DEBUG "Calling Seller constructor with ", Dumper($self); | |||||||||||||||||||||||||||
| 26 | return Net::Amazon::Result::Seller->new( | ||||||||||||||||||||||||||||
| 27 | xmlref => $self->{xmlref}->{SellerListings}, | ||||||||||||||||||||||||||||
| 28 | 6 | ); | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | return undef; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | ################################################## | ||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub properties { | ||||||||||||||||||||||||||
|
Subroutine
properties: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | ################################################## | ||||||||||||||||||||||||||||
| 37 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | die "properties() not defined in ", __PACKAGE__, ". Use result() instead"; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | ################################################## | ||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub as_string { | ||||||||||||||||||||||||||
|
Subroutine
as_string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 44 | ################################################## | ||||||||||||||||||||||||||||
| 45 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | return $self->result()->as_string(); | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | ################################################## | ||||||||||||||||||||||||||||
| 51 | 1 | ▶ | sub xmlref_add { | ||||||||||||||||||||||||||
|
Subroutine
xmlref_add: called CC=5 SCAR=17.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 52 | ################################################## | ||||||||||||||||||||||||||||
| 53 | 1 | my($self, $xmlref) = @_; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 1 | my $nof_items_added = 0; | |||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 1 | DEBUG("xmlref_add (before):", Data::Dumper::Dumper($xmlref)); | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 1 | ▶ | unless(ref($self->{xmlref}) eq "HASH" && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $self->{"xmlref"} eq "HASH" and ref $self->{"xmlref"}{"SellerListings"} eq "ARRAY"
MC/DC0%0/2
ref $self->{"xmlref"} eq "HASH" and ref $self->{"xmlref"}{"SellerListings"} eq "ARRAY"
ref $self->{"xmlref"} eq "HASH"
ref $self->{"xmlref"}{"SellerListings"} eq "ARRAY"
Truth table33%1/3
A and B
A= ref $self->{"xmlref"} eq "HASH"B= ref $self->{"xmlref"}{"SellerListings"} eq "ARRAY"
| |||||||||||||||||||||||||||||
| 60 | ref($self->{xmlref}->{SellerListings}) eq "ARRAY") { | ||||||||||||||||||||||||||||
| 61 | 1 | $self->{xmlref}->{SellerListings} = []; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 1 | ▶ | if(ref($xmlref->{SellerListings}->{SellerListing}) eq "ARRAY") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | # Is it an array of items? | ||||||||||||||||||||||||||||
| 66 | 10 | push @{$self->{xmlref}->{SellerListings}}, | |||||||||||||||||||||||||||
| 67 | 1 | $_ for @{$xmlref->{SellerListings}->{SellerListing}}; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 1 | $nof_items_added = scalar @{$xmlref->{SellerListings}->{SellerListing}}; | |||||||||||||||||||||||||||
| 70 | } else { | ||||||||||||||||||||||||||||
| 71 | # It is a single item | ||||||||||||||||||||||||||||
| 72 | 0 | push @{$self->{xmlref}->{SellerListings}}, | |||||||||||||||||||||||||||
| 73 | 0 | $xmlref->{SellerListings}->{SellerListing}; | |||||||||||||||||||||||||||
| 74 | 0 | $nof_items_added = 1; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | #DEBUG("(Seller) xmlref_add (after):", Data::Dumper::Dumper($self)); | ||||||||||||||||||||||||||||
| 78 | 1 | return $nof_items_added; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 1 | 1; | |||||||||||||||||||||||||||