| 1 | ###################################################################### | ||||||||||
| 2 | package Net::Amazon::Property::DigitalMusicTrack; | ||||||||||
| 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 | |||||||||||
| 8 | 24 | __PACKAGE__->make_accessor($_) for qw( | |||||||||
| 9 | binding | ||||||||||
| 10 | genre | ||||||||||
| 11 | label | ||||||||||
| 12 | manufacturer | ||||||||||
| 13 | publisher | ||||||||||
| 14 | release_date | ||||||||||
| 15 | studio | ||||||||||
| 16 | title | ||||||||||
| 17 | track_sequence | ||||||||||
| 18 | running_time); | ||||||||||
| 19 | |||||||||||
| 20 | 24 | __PACKAGE__->make_array_accessor($_) for qw(artists); | |||||||||
| 21 | |||||||||||
| 22 | ################################################## | ||||||||||
| 23 | 30 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 24 | ################################################## | ||||||||||
| 25 | 30 | my($class, %options) = @_; | |||||||||
| 26 | |||||||||||
| 27 | 30 | my $self = $class->SUPER::new(%options); | |||||||||
| 28 | 30 | bless $self, $class; # Bless into this class | |||||||||
| 29 | |||||||||||
| 30 | 30 | ▶ | if(exists $options{xmlref}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 30 | $self->init_via_xmlref($options{xmlref}); | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 30 | return $self; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | ################################################## | ||||||||||
| 38 | 1 | ▶ | sub artist { | ||||||||
|
Subroutine
artist: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 39 | ################################################## | ||||||||||
| 40 | 1 | my($self, $nameref) = @_; | |||||||||
| 41 | |||||||||||
| 42 | # Only return the first artist | ||||||||||
| 43 | 1 | return ($self->artists($nameref))[0]; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | ################################################## | ||||||||||
| 47 | 30 | ▶ | sub init_via_xmlref { | ||||||||
|
Subroutine
init_via_xmlref: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 48 | ################################################## | ||||||||||
| 49 | 30 | my($self, $xmlref) = @_; | |||||||||
| 50 | |||||||||||
| 51 | 30 | $self->SUPER::init_via_xmlref($xmlref); | |||||||||
| 52 | |||||||||||
| 53 | 30 | my $ref = $xmlref->{ItemAttributes}; | |||||||||
| 54 | |||||||||||
| 55 | # It could either be a Creator (and?)/or an Artist | ||||||||||
| 56 | 30 | my @artists; | |||||||||
| 57 | 30 | for my $artist (@{$ref->{Creator}}) { | |||||||||
| 58 | 30 | push @artists, $artist->{content}; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 30 | for my $artist (@{$ref->{Artist}}) { | |||||||||
| 62 | 0 | push @artists, $artist; | |||||||||
| 63 | } | ||||||||||
| 64 | 30 | $self->artists(\@artists); | |||||||||
| 65 | |||||||||||
| 66 | 30 | $self->binding($ref->{Binding}); | |||||||||
| 67 | 30 | $self->genre($ref->{Genre}); | |||||||||
| 68 | 30 | $self->label($ref->{Label}); | |||||||||
| 69 | 30 | $self->manufacturer($ref->{Manufcaturer}); | |||||||||
| 70 | 30 | $self->publisher($ref->{Publisher}); | |||||||||
| 71 | 30 | $self->release_date($ref->{ReleaseDate}); | |||||||||
| 72 | 30 | $self->running_time($ref->{RunningTime}->{content}); | |||||||||
| 73 | 30 | $self->studio($ref->{Studio}); | |||||||||
| 74 | 30 | $self->title($ref->{Title}); | |||||||||
| 75 | 30 | $self->track_sequence($ref->{TrackSequence}); | |||||||||
| 76 | |||||||||||
| 77 | 30 | my $year = 0; | |||||||||
| 78 | 30 | ▶ | if (defined $ref->{ReleaseDate}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 79 | 30 | $year = (split(/\-/, $ref->{ReleaseDate}))[0]; | |||||||||
| 80 | } | ||||||||||
| 81 | 30 | $self->year($year); | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | ################################################## | ||||||||||
| 85 | 10 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 86 | ################################################## | ||||||||||
| 87 | 10 | my($self) = @_; | |||||||||
| 88 | |||||||||||
| 89 | 10 | return join('/', $self->artists) . ", " . | |||||||||
| 90 | '"' . $self->title. '"' . ", " . | ||||||||||
| 91 | $self->year . ", " . | ||||||||||
| 92 | $self->_best_effort_price() . ", " . | ||||||||||
| 93 | $self->Asin; | ||||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | 24 | 1; | |||||||||
| 97 | |||||||||||
| 98 | __END__ | ||||||||||