Amazon/Response/Seller.pm

filter: Statementstmt 80.0% 32 / 40 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 77.7% 7 / 9 Podpod 40.0% 2 / 5 totaltotal 69.2% 45 / 65 CC 6 SCAR 11.0
CC
6
Cov
73%
xmlref_add
5.8
result
2.1
properties
2.0
CRAP 3.0
« Amazon/Attribute/ReviewSet.pm ↑ Summary Amazon/Response.pm »
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
BranchTrueFalseTotal
if ($self->is_success) 6 0 6
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
BranchTrueFalseTotal
unless (ref $self->{"xmlref"} eq "HASH" and ref $self->{"xmlref"}{"SellerListings"} eq "ARRAY") 1 0 1
Condition33%1/3
ref $self->{"xmlref"} eq "HASH" and ref $self->{"xmlref"}{"SellerListings"} eq "ARRAY"
!ll&&!rl&&r
010
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"
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if (ref $xmlref->{'SellerListings'}{'SellerListing'} eq 'ARRAY') { } 1 0 1
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;
« Amazon/Attribute/ReviewSet.pm ↑ Summary Amazon/Response.pm »