Monitor/Array.pm

filter: Statementstmt 34.9% 22 / 63 Branchbran 18.7% 3 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 21.0% 4 / 19 Podpod 0.0% 0 / 1 totaltotal 29.2% 29 / 99 CC 9 SCAR 19.9
CC
9
Cov
32%
DESTROY
20.0
SPLICE
20.0
TIEARRAY
3.0
CRAP 7.3
« Monitor.pm ↑ Summary Monitor/Hash.pm »
1 package Devel::Monitor::Array;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 1 ▶use Devel::Monitor::Common qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 1 our $id = 0;
8
9 2 ▶sub TIEARRAY {
Subroutine TIEARRAY: called CC=3 SCAR=11.0
10 2 my ($class, $varRef, $id, $isCode) = @_;
11 2 my $self = {};
12 2 bless($self => $class);
13 2 $self->{Devel::Monitor::Common::F_VAR()} = [@$varRef];
14 2 ▶ if ($id) {
Branch: 1 branch
BranchTrueFalseTotal
if ($id) { } 2 0 2
15 2 $self->{Devel::Monitor::Common::F_ID()} = $id;
16 } else {
17 0 $self->{Devel::Monitor::Common::F_ID()} = 'array_'.++$id;
18 }
19 2 $self->{Devel::Monitor::Common::F_IS_CODE()} = $isCode;
20 2 ▶ if ($isCode) {
Branch: 1 branch
BranchTrueFalseTotal
if ($isCode) { } 1 1 2
21 1 Devel::Monitor::Common::printMsg("MONITOR CODE ARRAY : ".$self->{Devel::Monitor::Common::F_ID()}."\n");
22 } else {
23 1 Devel::Monitor::Common::printMsg("MONITOR ARRAY : ".$self->{Devel::Monitor::Common::F_ID()}."\n");
24 }
25 2 return $self;
26 }
27
28 0 ▶sub DESTROY {
Subroutine DESTROY: not called CC=4 SCAR=30.0
29 0 my $self = shift;
30 0 ▶ if ($self->{Devel::Monitor::Common::F_IS_CODE()}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'_isCode'}) { } 0 0 0
31 0 ▶ Devel::Monitor::Common::printMsg("DESTROY CODE ARRAY : ".$self->{Devel::Monitor::Common::F_ID()}."\n") unless $self->{Devel::Monitor::Common::F_UNMONITORED()};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_unmonitored"} 0 0 0
32 } else {
33 0 ▶ Devel::Monitor::Common::printMsg("DESTROY ARRAY : ".$self->{Devel::Monitor::Common::F_ID()}."\n") unless $self->{Devel::Monitor::Common::F_UNMONITORED()};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_unmonitored"} 0 0 0
34 }
35 }
36
37 0 ▶sub unmonitor {
Subroutine unmonitor: not called CC=1 SCAR=6.9
Pod undocumented
38 0 my ($varRef) = @_;
39 0 my $arrayRef;
40 {
41 0 my $self = tied @$varRef;
42 0 $arrayRef = $self->{Devel::Monitor::Common::F_VAR()};
43 0 $self->{Devel::Monitor::Common::F_UNMONITORED()} = 1;
44 0 Devel::Monitor::Common::printMsg("UNMONITOR ARRAY : ".$self->{Devel::Monitor::Common::F_ID()}."\n");
45 }
46 0 untie @$varRef;
47 0 @$varRef = @$arrayRef;
48 }
49
50 #Copy/Pasted from Tie::StdArray into Tie::Array.pm
51 #Added "->{Devel::Monitor::Common::F_VAR()}"
52 0 ▶sub FETCHSIZE { scalar @{$_[0]->{Devel::Monitor::Common::F_VAR()}} }
Subroutine FETCHSIZE: not called CC=1 SCAR=6.9
53 0 ▶sub STORESIZE { $#{$_[0]->{Devel::Monitor::Common::F_VAR()}} = $_[1]-1 }
Subroutine STORESIZE: not called CC=1 SCAR=6.9
54 0 ▶sub STORE { $_[0]->{Devel::Monitor::Common::F_VAR()}->[$_[1]] = $_[2] }
Subroutine STORE: not called CC=1 SCAR=6.9
55 0 ▶sub FETCH { $_[0]->{Devel::Monitor::Common::F_VAR()}->[$_[1]] }
Subroutine FETCH: not called CC=1 SCAR=6.9
56 0 ▶sub CLEAR { @{$_[0]->{Devel::Monitor::Common::F_VAR()}} = () }
Subroutine CLEAR: not called CC=1 SCAR=6.9
57 0 ▶sub POP { pop(@{$_[0]->{Devel::Monitor::Common::F_VAR()}}) }
Subroutine POP: not called CC=1 SCAR=6.9
58 0 ▶sub PUSH { my $o = shift; push(@{$o->{Devel::Monitor::Common::F_VAR()}},@_) }
Subroutine PUSH: not called CC=1 SCAR=6.9
59 0 ▶sub SHIFT { shift(@{$_[0]->{Devel::Monitor::Common::F_VAR()}}) }
Subroutine SHIFT: not called CC=1 SCAR=6.9
60 0 ▶sub UNSHIFT { my $o = shift; unshift(@{$o->{Devel::Monitor::Common::F_VAR()}},@_) }
Subroutine UNSHIFT: not called CC=1 SCAR=6.9
61 0 ▶sub EXISTS { exists $_[0]->{Devel::Monitor::Common::F_VAR()}->[$_[1]] }
Subroutine EXISTS: not called CC=1 SCAR=6.9
62 0 ▶sub DELETE { delete $_[0]->{Devel::Monitor::Common::F_VAR()}->[$_[1]] }
Subroutine DELETE: not called CC=1 SCAR=6.9
63 0 ▶sub EXTEND { }
Subroutine EXTEND: not called CC=1 SCAR=0.0
64 0 ▶sub SPLICE {
Subroutine SPLICE: not called CC=4 SCAR=30.0
65 0 my $ob = shift;
66 0 my $sz = $ob->FETCHSIZE;
67 0 ▶ my $off = @_ ? shift : 0;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
68 0 ▶ $off += $sz if $off < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $off < 0 0 0 0
69 0 ▶ my $len = @_ ? shift : $sz-$off;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
70 0 return splice(@{$ob->{Devel::Monitor::Common::F_VAR()}},$off,$len,@_);
71 }
72
73 1 1;
« Monitor.pm ↑ Summary Monitor/Hash.pm »