StorableDir/BackedArray.pm

filter: Statementstmt 78.8% 41 / 52 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 82.3% 14 / 17 Podpod n/a totaltotal 75.6% 56 / 74 CC 2 SCAR 2.5
CC
2
Cov
76%
TIEARRAY
2.1
STORESIZE
2.0
DELETE
2.0
CRAP 1.3
« StorableDir/BackedHash.pm ↑ Summary
1 package Tie::StorableDir::BackedArray;
2  
3 4 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use base 'Tie::Array';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 12 ▶sub TIEARRAY {
Subroutine TIEARRAY: called CC=2 SCAR=7.2
10 12 my ($class, $parent, $backing) = @_;
11 12 ▶ $class = ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
0120
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
12 12 my $self = [$backing, $parent];
13 12 bless $self, $class;
14 12 return $self;
15 }
16  
17 3 ▶sub FETCH {
Subroutine FETCH: called CC=1 SCAR=0.0
18 3 my ($self, $index) = @_;
19 3 return $self->[1]->translate($self->[0][$index]);
20 }
21  
22 7 ▶sub FETCHSIZE {
Subroutine FETCHSIZE: called CC=1 SCAR=0.0
23 7 my ($self) = @_;
24 7 return scalar @{$self->[0]};
25 }
26  
27 1 ▶sub STORE {
Subroutine STORE: called CC=1 SCAR=0.0
28 1 my ($self, $index, $value) = @_;
29 1 $self->[0][$index] = $value;
30 }
31  
32 0 ▶sub STORESIZE {
Subroutine STORESIZE: not called CC=1 SCAR=6.9
33 0 my ($self, $size) = @_;
34 0 @{$self->[0]} = $size;
35 }
36  
37 1 ▶sub EXISTS {
Subroutine EXISTS: called CC=1 SCAR=0.0
38 1 my ($self, $index) = @_;
39 1 return exists $self->[0][$index];
40 }
41  
42 0 ▶sub DELETE {
Subroutine DELETE: not called CC=1 SCAR=6.9
43 0 my ($self, $index) = @_;
44 0 delete $self->[0][$index];
45 }
46  
47 1 ▶sub CLEAR {
Subroutine CLEAR: called CC=1 SCAR=0.0
48 1 my ($self) = @_;
49 1 @{$self->[0]} = ();
50 }
51  
52 1 ▶sub PUSH {
Subroutine PUSH: called CC=1 SCAR=0.0
53 1 my ($self, @v) = @_;
54 1 push @{$self->[0]}, @v;
55 }
56  
57 1 ▶sub POP {
Subroutine POP: called CC=1 SCAR=0.0
58 1 my $self = shift;
59 1 return $self->[1]->translate(pop @{$self->[0]});
60 }
61  
62 1 ▶sub SHIFT {
Subroutine SHIFT: called CC=1 SCAR=0.0
63 1 my $self = shift;
64 1 return $self->[1]->translate(shift @{$self->[0]});
65 }
66  
67 1 ▶sub UNSHIFT {
Subroutine UNSHIFT: called CC=1 SCAR=0.0
68 1 my ($self, @v) = @_;
69 1 unshift @{$self->[0]}, @v;
70 }
71  
72 0 ▶sub SPLICE {
Subroutine SPLICE: not called CC=1 SCAR=6.9
73 0 my ($this, $offset, $length, @l) = @_;
74 0 my @v = splice @{$this->[0]}, $offset, $length, @l;
75 0 @v = map { $this->[1]->translate($_) } @v;
76 0 return @v;
77 }
78  
79 4 1;
« StorableDir/BackedHash.pm ↑ Summary