| 1 | ###################################################################### | ||||||||||
| 2 | package Net::Amazon::Attribute::Review; | ||||||||||
| 3 | ###################################################################### | ||||||||||
| 4 | 24 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 24 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 24 | ▶ | use Log::Log4perl qw(:easy); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 24 | ▶ | use base qw(Net::Amazon); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 24 | __PACKAGE__->make_accessor($_) for qw(date asin rating summary content | |||||||||
| 10 | total_votes helpful_votes customer_id | ||||||||||
| 11 | customer_name customer_location); | ||||||||||
| 12 | |||||||||||
| 13 | 24 | ▶ | use constant ELEMENT_TO_METHOD_MAP => { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | # XXX: should ASIN be Asin, ASIN, or asin? | ||||||||||
| 15 | 'ASIN' => 'asin', | ||||||||||
| 16 | 'Content' => 'content', | ||||||||||
| 17 | 'CustomerId' => 'customer_id', | ||||||||||
| 18 | 'CustomerLocation' => 'customer_location', | ||||||||||
| 19 | 'CustomerName' => 'customer_name', | ||||||||||
| 20 | 'Date' => 'date', | ||||||||||
| 21 | 'HelpfulVotes' => 'helpful_votes', | ||||||||||
| 22 | 'Rating' => 'rating', | ||||||||||
| 23 | 'Summary' => 'summary', | ||||||||||
| 24 | 'TotalVotes' => 'total_votes', | ||||||||||
| 25 | 24 | }; | |||||||||
| 26 | |||||||||||
| 27 | ################################################## | ||||||||||
| 28 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 29 | ################################################## | ||||||||||
| 30 | 0 | my($class, %options) = @_; | |||||||||
| 31 | |||||||||||
| 32 | 0 | my $self = { | |||||||||
| 33 | rating => "", | ||||||||||
| 34 | summary => "", | ||||||||||
| 35 | content => "", | ||||||||||
| 36 | helpful_votes => "", | ||||||||||
| 37 | customer_id => "", | ||||||||||
| 38 | customer_name => "", | ||||||||||
| 39 | customer_location => "", | ||||||||||
| 40 | asin => "", | ||||||||||
| 41 | date => "", | ||||||||||
| 42 | total_votes => "", | ||||||||||
| 43 | %options, | ||||||||||
| 44 | }; | ||||||||||
| 45 | |||||||||||
| 46 | 0 | bless $self, $class; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | ################################################## | ||||||||||
| 50 | 0 | ▶ | sub init_via_xmlref { | ||||||||
|
Subroutine
init_via_xmlref: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 51 | ################################################## | ||||||||||
| 52 | 0 | my($self, $xmlref) = @_; | |||||||||
| 53 | |||||||||||
| 54 | 0 | my $href = (ELEMENT_TO_METHOD_MAP); | |||||||||
| 55 | |||||||||||
| 56 | 0 | for(keys %$href) { | |||||||||
| 57 | 0 | my $method = lc($href->{$_}); | |||||||||
| 58 | 0 | ▶ | if(defined $xmlref->{$_}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | 0 | $self->$method($xmlref->{$_}); | |||||||||
| 60 | } | ||||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 0 | $self->customer_location($xmlref->{Reviewer}{Location}); | |||||||||
| 64 | 0 | $self->customer_name($xmlref->{Reviewer}{Name}); | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 24 | 1; | |||||||||
| 68 | |||||||||||
| 69 | __END__ | ||||||||||