| 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
| |||||||||||
| 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__ | ||||||||||