Amazon/Collection.pm

filter: Statementstmt 43.2% 16 / 37 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 45.4% 5 / 11 Podpod 0.0% 0 / 6 totaltotal 36.2% 21 / 58 SCAR 16.2
CC
3
Cov
39%
add_Amazon
6.0
collection
6.0
new
2.0
CRAP 5.0
« Amazon/Item.pm ↑ Summary
1 package XML::Amazon::Collection;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use XML::Amazon;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use LWP::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use XML::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub new{
10 0 ▶ my $pkg = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
11 0 my $data = {
12 total_results => undef,
13 total_pages => undef,
14 current_page => undef,
15 collection => []
16 };
17 0 bless $data, $pkg;
18 }
19  
20 sub add_Amazon{
21 0 ▶ my $self = shift;
Subroutine add_Amazon: not called CC=2 SCAR=17.9
Pod undocumented
22 0 my $add_data = shift;
23
24 0 ▶ if(ref $add_data ne "XML::Amazon::Item") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $add_data ne "XML::Amazon::Item") 0 0 0
25 0 warn "add_Amazon called with type ", ref $add_data;
26 0 return undef;
27 }
28 0 push @{$self->{collection}}, $add_data;
29 }
30  
31 sub total_results {
32 0 ▶ my $self = shift;
Subroutine total_results: not called CC=1 SCAR=6.9
Pod undocumented
33 0 return $self->{total_results};
34 }
35  
36 sub total_pages {
37 0 ▶ my $self = shift;
Subroutine total_pages: not called CC=1 SCAR=6.9
Pod undocumented
38 0 return $self->{total_pages};
39 }
40  
41 sub current_page {
42 0 ▶ my $self = shift;
Subroutine current_page: not called CC=1 SCAR=6.9
Pod undocumented
43 0 return $self->{current_page};
44 }
45  
46 sub collection{
47 0 ▶ my $self = shift;
Subroutine collection: not called CC=2 SCAR=17.9
Pod undocumented
48 0 my @list;
49 0 ▶ for (my $i = 0; $self->{collection}->[$i]; $i++){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"collection"}[$i]) 0 0 0
50 0 push @list, $self->{collection}->[$i];
51 }
52 0 return @list;
53 }
54  
55 1 1;
« Amazon/Item.pm ↑ Summary