Monitor/Trace.pm

filter: Statementstmt 100% 43 / 43 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 6 totaltotal 89.0% 57 / 64 CC 6 SCAR 8.3
CC
6
Cov
98%
getCircularPath
4.0
dump
3.0
BEGIN
1.0
CRAP 2.3
« Monitor/Scalar.pm ↑ Summary Monitor/TestArray.pm »
1 package Devel::Monitor::Trace;
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 13 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
8 13 my ($class) = @_;
9 13 my $self = {};
10 13 bless($self => $class);
11 13 $self->{_traceItems} = [];
12 13 return $self;
13 }
14
15 155 ▶sub push {
Subroutine push: called CC=1 SCAR=0.0
Pod undocumented
16 155 my $self = shift;
17 155 my $varRef = shift;
18 155 my $source = shift;
19 155 my $trace = Devel::Monitor::TraceItem->new($varRef,$source);
20 155 push(@{$self->{_traceItems}},$trace);
21 }
22
23 155 ▶sub pop {
Subroutine pop: called CC=1 SCAR=0.0
Pod undocumented
24 155 my $self = shift;
25 155 pop @{$self->{_traceItems}};
26 }
27
28 19 ▶sub getTraceItems {
Subroutine getTraceItems: called CC=1 SCAR=0.0
Pod undocumented
29 19 return shift->{_traceItems};
30 }
31
32 20 ▶sub getCircularPath {
Subroutine getCircularPath: called CC=4 SCAR=13.9
Pod undocumented
33 20 my $self = shift;
34 20 my $tmp = '';
35 20 my $isFirst = 1;
36 20 foreach my $trace (@{$self->{_traceItems}}) {
37 74 ▶ if ($isFirst) {
Branch: 1 branch
BranchTrueFalseTotal
if ($isFirst) { } 20 54 74
38 20 $tmp .= $trace->getVarRef();
39 20 $isFirst = 0;
40 } else {
41 54 ▶ $tmp .= $trace->getSource() if $trace->getSource();
Branch: 1 branch
BranchTrueFalseTotal
if $trace->getSource 54 0 54
42 }
43 }
44 20 return $tmp;
45 }
46
47 20 ▶sub dump {
Subroutine dump: called CC=3 SCAR=11.0
Pod undocumented
48 20 my $self = shift;
49 20 my $i = 1;
50 20 foreach my $trace (@{$self->{_traceItems}}) {
51 74 ▶ if ($trace->getSource()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($trace->getSource) { } 54 20 74
52 54 Devel::Monitor::Common::printMsg($i.' - Source : '.$trace->getSource()."\n".
53 ' Item : '.$trace->getVarRef()."\n");
54 } else {
55 20 Devel::Monitor::Common::printMsg($i.' - Item : '.$trace->getVarRef()."\n");
56 }
57 74 $i++;
58 }
59 }
60
61 1 1;
« Monitor/Scalar.pm ↑ Summary Monitor/TestArray.pm »