| Net-Amazon documentation | Contained in the Net-Amazon distribution. |
Net::Amazon::Property::VideoGames - Class for software on amazon.com
use Net::Amazon;
# ...
if($resp->is_success()) {
for my $prop ($resp->properties) {
print join("/", $prop->platforms()), " ",
$prop->title(), " ",
$prop->publisher(), "\n";
}
Net::Amazon::Property::VideoGames is derived from
Net::Amazon::Property and on top of the all-purpose
methods the base class provides, it offers specialized accessors for
software parameters.
Returns a list of the software's platforms. There's also a platform() method
which just returns the first platform.
Returns the software's publishing company as a string.
Returns the software's title as a string.
Returns the software's EAN number.
Returns the video games's media type as a string.
Returns the video games's label type as a string.
Returns the video games's studio type as a string.
Returns the video games's brand type as a string.
Returns the video games's manufacturer type as a string.
Returns the video games's ESRB age rating type as a string.
Returns the video games's media type as a string.
Returns the video games's number of media (number of discs) as a string.
Returns the video games's UPC as a string.
Initializes an object by passing a hash of hashes structure containing
the XML data returned from the service. Usually, this is just used by
Net::Amazon internally to initialize objects for on backcoming
data.
Check out Net::Amazon::Property for all-purpose accessors, like
year, OurPrice, ListPrice, etc.
Christopher Boumenot, <boumenot@gmail.com>
Copyright 2006 by Christopher Boumenot <lt>boumenot@gmail.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Net-Amazon documentation | Contained in the Net-Amazon distribution. |
###################################################################### package Net::Amazon::Property::VideoGames; ###################################################################### use warnings; use strict; use base qw(Net::Amazon::Property); use Log::Log4perl qw(:easy get_logger); __PACKAGE__->make_accessor($_) for qw(brand ean esrb_rating label upc manufacturer media nummedia publisher studio); __PACKAGE__->make_array_accessor($_) for qw(platforms authors); ################################################## sub new { ################################################## my($class, %options) = @_; my $self = $class->SUPER::new(%options); bless $self, $class; # Bless into this class if(exists $options{xmlref}) { $self->init_via_xmlref($options{xmlref}); } return $self; } ################################################## sub init_via_xmlref { ################################################## my($self, $xmlref) = @_; $self->SUPER::init_via_xmlref($xmlref); my $ref = $xmlref->{ItemAttributes}; $self->brand($ref->{Brand}); $self->ean($ref->{EAN}); $self->esrb_rating($ref->{ESRBAgeRating}); $self->label($ref->{Label}); $self->authors($ref->{Author}); $self->platforms($ref->{Platform}); $self->publisher($ref->{Publisher}); $self->manufacturer($ref->{Publisher}); $self->studio($ref->{Studio}); $self->upc($ref->{UPC}); $self->media($ref->{NumberOfItems}); $self->NumMedia($ref->{NumberOfItems}); $self->nummedia($ref->{NumberOfItems}); my $year = 0; if (exists $ref->{ReleaseDate}) { $year = (split(/\-/, $ref->{ReleaseDate}))[0]; } $self->year($year); } ################################################## sub platform { ################################################## my($self, $nameref) = @_; # Only return the first platform return ($self->platforms($nameref))[0]; } ################################################## sub author { ################################################## my($self, $nameref) = @_; # Only return the first author return ($self->authors($nameref))[0]; } ################################################## sub as_string { ################################################## my($self) = @_; return join('/', $self->platforms) . ", " . '"' . $self->title . '"' . ", " . $self->_best_effort_price() . ", " . $self->ASIN; } 1; __END__