Amazon/Property/Software.pm

filter: Statementstmt 95.0% 38 / 40 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 25.0% 1 / 4 totaltotal 87.5% 49 / 56 CC 3 SCAR 4.1
CC
3
Cov
93%
new
2.0
platform
2.0
as_string
2.0
CRAP 1.5
« Amazon/Property/VideoGames.pm ↑ Summary Amazon/Property/DVD.pm »
1 ######################################################################
2 package Net::Amazon::Property::Software;
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 media
10 manufacturer nummedia publisher studio);
11 24 __PACKAGE__->make_array_accessor($_) for qw(platforms);
12  
13  
14 ##################################################
15 8 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod documented
16 ##################################################
17 8 my($class, %options) = @_;
18  
19 8 my $self = $class->SUPER::new(%options);
20 8 bless $self, $class; # Bless into this class
21  
22 8 ▶ if(exists $options{xmlref}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $options{"xmlref"}) 8 0 8
23 8 $self->init_via_xmlref($options{xmlref});
24 }
25  
26 8 return $self;
27 }
28  
29 ##################################################
30 8 ▶sub init_via_xmlref {
Subroutine init_via_xmlref: called CC=1 SCAR=0.0
Pod undocumented
31 ##################################################
32 8 my($self, $xmlref) = @_;
33  
34 8 $self->SUPER::init_via_xmlref($xmlref);
35  
36 8 my $ref = $xmlref->{ItemAttributes};
37  
38 8 $self->brand($ref->{Brand});
39 8 $self->ean($ref->{EAN});
40 8 $self->esrb_rating($ref->{ESRBAgeRating});
41 8 $self->label($ref->{Label});
42 8 $self->manufacturer($ref->{Manufacturer});
43 8 $self->platforms($ref->{Platform});
44 8 $self->publisher($ref->{Publisher});
45 8 $self->studio($ref->{Studio});
46  
47 8 $self->media($ref->{Binding});
48  
49 8 $self->NumMedia($ref->{NumberOfItems});
50 8 $self->nummedia($ref->{NumberOfItems});
51 }
52  
53 ##################################################
54 0 ▶sub platform {
Subroutine platform: not called CC=1 SCAR=6.9
Pod undocumented
55 ##################################################
56 0 my($self, $nameref) = @_;
57  
58 # Only return the first platform
59 0 return ($self->platforms($nameref))[0];
60 }
61  
62 ##################################################
63 4 ▶sub as_string {
Subroutine as_string: called CC=2 SCAR=6.9
Pod undocumented
64 ##################################################
65 4 my($self) = @_;
66  
67 4 ▶ my @a = (defined $self->platforms) ? $self->platforms : qw();
Branch: 1 branch
BranchTrueFalseTotal
defined $self->platforms ? : 2 2 4
68  
69 4 return join('/', @a) . ", " .
70 '"' . $self->title . '"' . ", " .
71 $self->_best_effort_price() . ", " .
72 $self->ASIN;
73 }
74  
75 24 1;
76  
77 __END__
« Amazon/Property/VideoGames.pm ↑ Summary Amazon/Property/DVD.pm »