blib/lib/XML/Pastor/Stack.pm

filter: Statementstmt 78.5% 33 / 42 Branchbran 25.0% 1 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 10 / 12 Podpod 100% 8 / 8 totaltotal 74.6% 53 / 71 CC 4 SCAR 8.2
CC
4
Cov
71%
empty
6.0
new
3.7
clear
2.0
CRAP 2.3
« blib/lib/XML/Pastor.pm ↑ Summary blib/lib/XML/Pastor/Meta.pm »
1 10 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶no warnings qw(uninitialized);
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6
7 #===============================================
8 package XML::Pastor::Stack;
9
10
11 10 our $VERSION = '0.01';
12
13 33 ▶sub new {
Subroutine new: called CC=3 SCAR=13.0
Pod documented
14 33 my $proto = shift();
15 33 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
0330
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
16
17 33 my $self = [];
18 33 ▶ if(@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 33 33
19 0 push(@{ $self }, @_);
20 }
21
22 33 return bless($self, $class);
23 }
24
25 2679 ▶sub peek {
Subroutine peek: called CC=1 SCAR=0.0
Pod documented
26 2679 my $self = shift();
27
28 2679 return $self->get(0);
29 }
30
31 0 ▶sub clear {
Subroutine clear: not called CC=1 SCAR=6.9
Pod documented
32 0 my $self = shift();
33
34 0 $#{ $self } = -1;
35 }
36
37 3404 ▶sub get {
Subroutine get: called CC=1 SCAR=0.0
Pod documented
38 3404 my $self = shift();
39 3404 my $index = shift();
40
41 3404 return $self->[$index];
42 }
43
44 1292 ▶sub count {
Subroutine count: called CC=1 SCAR=0.0
Pod documented
45 1292 my $self = shift();
46
47 1292 return $#{ $self } + 1;
48 }
49
50 0 ▶sub empty {
Subroutine empty: not called CC=2 SCAR=17.9
Pod documented
51 0 my $self = shift();
52
53 0 ▶ if($self->count() == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->count == 0) 0 0 0
54 0 return 1;
55 }
56
57 0 return 0;
58 }
59
60 396 ▶sub pop {
Subroutine pop: called CC=1 SCAR=0.0
Pod documented
61 396 my $self = shift();
62
63 396 return shift(@{ $self });
64 }
65
66 396 ▶sub push {
Subroutine push: called CC=1 SCAR=0.0
Pod documented
67 396 my $self = shift();
68
69 396 unshift(@{ $self }, shift());
70 }
71
72 10 1;
73
74 __END__
« blib/lib/XML/Pastor.pm ↑ Summary blib/lib/XML/Pastor/Meta.pm »