Amazon/Result/Seller.pm

filter: Statementstmt 97.5% 40 / 41 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 2 totaltotal 92.4% 49 / 53 CC 3 SCAR 4.7
CC
3
Cov
95%
new
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« Amazon/Property/CE.pm ↑ Summary Amazon/Property/Book.pm »
1 ######################################################################
2 package Net::Amazon::Result::Seller;
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);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Log::Log4perl qw(:easy);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Net::Amazon::Result::Seller::Listing;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our @DEFAULT_ATTRIBUTES = qw(StoreName SellerNickname
13 NumberOfOpenListings StoreId SellerId);
14 1 __PACKAGE__->make_accessor($_) for @DEFAULT_ATTRIBUTES;
15 1 __PACKAGE__->make_array_accessor($_) for qw(listings);
16  
17 ##################################################
18 6 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
19 ##################################################
20 6 my($class, %options) = @_;
21  
22 6 ▶ if(!$options{xmlref}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($options{"xmlref"}) 0 6 6
23 0 die "Mandatory param xmlref missing";
24 }
25  
26 6 my @listings = ();
27  
28 6 my $self = {
29 %options,
30 };
31  
32 6 bless $self, $class;
33  
34 6 my $ref = $options{xmlref};
35  
36 6 $self->StoreName($ref->[0]->{Seller}->{Nickname});
37 6 $self->SellerNickname($ref->[0]->{Seller}->{Nickname});
38 6 $self->SellerId($ref->[0]->{Seller}->{SellerId});
39 6 $self->StoreId($ref->[0]->{Seller}->{SellerId});
40 6 $self->NumberOfOpenListings(scalar(@$ref));
41  
42 6 for my $listing (@$ref) {
43 60 push @listings,
44 Net::Amazon::Result::Seller::Listing->new(
45 xmlref => $listing);
46 }
47  
48 6 $self->listings(\@listings);
49  
50 6 return $self;
51 }
52  
53 ##################################################
54 2 ▶sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod undocumented
55 ##################################################
56 2 my($self) = @_;
57  
58 2 my $result = $self->StoreName() .
59 " (" .
60 $self->SellerNickname() .
61 "): " .
62 $self->NumberOfOpenListings() .
63 "";
64  
65 2 return $result;
66 }
67  
68 1 1;
69  
70 __END__
« Amazon/Property/CE.pm ↑ Summary Amazon/Property/Book.pm »