| 1 | ###################################################################### | ||||||||||
| 2 | package Net::Amazon::Property::VideoGames; | ||||||||||
| 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 base qw(Net::Amazon::Property); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 24 | ▶ | use Log::Log4perl qw(:easy get_logger); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 24 | __PACKAGE__->make_accessor($_) for qw(brand ean esrb_rating label upc | |||||||||
| 10 | manufacturer media nummedia publisher studio); | ||||||||||
| 11 | 24 | __PACKAGE__->make_array_accessor($_) for qw(platforms authors); | |||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | ################################################## | ||||||||||
| 15 | 14 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 16 | ################################################## | ||||||||||
| 17 | 14 | my($class, %options) = @_; | |||||||||
| 18 | |||||||||||
| 19 | 14 | my $self = $class->SUPER::new(%options); | |||||||||
| 20 | 14 | bless $self, $class; # Bless into this class | |||||||||
| 21 | |||||||||||
| 22 | 14 | ▶ | if(exists $options{xmlref}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 14 | $self->init_via_xmlref($options{xmlref}); | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 14 | return $self; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | ################################################## | ||||||||||
| 30 | 14 | ▶ | sub init_via_xmlref { | ||||||||
|
Subroutine
init_via_xmlref: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 31 | ################################################## | ||||||||||
| 32 | 14 | my($self, $xmlref) = @_; | |||||||||
| 33 | |||||||||||
| 34 | 14 | $self->SUPER::init_via_xmlref($xmlref); | |||||||||
| 35 | |||||||||||
| 36 | 14 | my $ref = $xmlref->{ItemAttributes}; | |||||||||
| 37 | |||||||||||
| 38 | 14 | $self->brand($ref->{Brand}); | |||||||||
| 39 | 14 | $self->ean($ref->{EAN}); | |||||||||
| 40 | 14 | $self->esrb_rating($ref->{ESRBAgeRating}); | |||||||||
| 41 | 14 | $self->label($ref->{Label}); | |||||||||
| 42 | 14 | $self->authors($ref->{Author}); | |||||||||
| 43 | 14 | $self->platforms($ref->{Platform}); | |||||||||
| 44 | 14 | $self->publisher($ref->{Publisher}); | |||||||||
| 45 | 14 | $self->manufacturer($ref->{Publisher}); | |||||||||
| 46 | 14 | $self->studio($ref->{Studio}); | |||||||||
| 47 | 14 | $self->upc($ref->{UPC}); | |||||||||
| 48 | |||||||||||
| 49 | 14 | $self->media($ref->{NumberOfItems}); | |||||||||
| 50 | |||||||||||
| 51 | 14 | $self->NumMedia($ref->{NumberOfItems}); | |||||||||
| 52 | 14 | $self->nummedia($ref->{NumberOfItems}); | |||||||||
| 53 | |||||||||||
| 54 | 14 | my $year = 0; | |||||||||
| 55 | 14 | ▶ | if (exists $ref->{ReleaseDate}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 14 | $year = (split(/\-/, $ref->{ReleaseDate}))[0]; | |||||||||
| 57 | } | ||||||||||
| 58 | 14 | $self->year($year); | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | ################################################## | ||||||||||
| 62 | 0 | ▶ | sub platform { | ||||||||
|
Subroutine
platform: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 63 | ################################################## | ||||||||||
| 64 | 0 | my($self, $nameref) = @_; | |||||||||
| 65 | |||||||||||
| 66 | # Only return the first platform | ||||||||||
| 67 | 0 | return ($self->platforms($nameref))[0]; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | |||||||||||
| 71 | ################################################## | ||||||||||
| 72 | 0 | ▶ | sub author { | ||||||||
|
Subroutine
author: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 73 | ################################################## | ||||||||||
| 74 | 0 | my($self, $nameref) = @_; | |||||||||
| 75 | |||||||||||
| 76 | # Only return the first author | ||||||||||
| 77 | 0 | return ($self->authors($nameref))[0]; | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | ################################################## | ||||||||||
| 81 | 8 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 82 | ################################################## | ||||||||||
| 83 | 8 | my($self) = @_; | |||||||||
| 84 | |||||||||||
| 85 | 8 | return join('/', $self->platforms) . ", " . | |||||||||
| 86 | '"' . $self->title . '"' . ", " . | ||||||||||
| 87 | $self->_best_effort_price() . ", " . | ||||||||||
| 88 | $self->ASIN; | ||||||||||
| 89 | } | ||||||||||
| 90 | |||||||||||
| 91 | 24 | 1; | |||||||||
| 92 | |||||||||||
| 93 | __END__ | ||||||||||