Amazon/Collection.pm

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