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