Log4perl/NDC.pm

filter: Statementstmt 82.6% 19 / 23 Branchbran 62.5% 5 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 4 / 4 totaltotal 80.9% 34 / 42 CC 5 SCAR 9.8
CC
5
Cov
77%
pop
6.0
push
3.1
get
2.0
CRAP 2.7
« Log4perl/Appender/Buffer.pm ↑ Summary Log4perl/Appender/TestArrayBuffer.pm »
1 ##################################################
2 package Log::Log4perl::NDC;
3 ##################################################
4  
5 54 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 54 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 54 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 54 our @NDC_STACK = ();
10 54 our $MAX_SIZE = 5;
11  
12 ###########################################
13 4 ▶sub get {
Subroutine get: called CC=2 SCAR=6.9
Pod documented
14 ###########################################
15 4 ▶ if(@NDC_STACK) {
Branch: 1 branch
BranchTrueFalseTotal
if (@Log::Log4perl::NDC::NDC_STACK) { } 3 1 4
16 # Return elements blank separated
17 3 return join " ", @NDC_STACK;
18 } else {
19 1 return "[undef]";
20 }
21 }
22  
23 ###########################################
24 0 ▶sub pop {
Subroutine pop: not called CC=2 SCAR=17.9
Pod documented
25 ###########################################
26 0 ▶ if(@NDC_STACK) {
Branch: 1 branch
BranchTrueFalseTotal
if (@Log::Log4perl::NDC::NDC_STACK) { } 0 0 0
27 0 return pop @NDC_STACK;
28 } else {
29 0 return undef;
30 }
31 }
32  
33 ###########################################
34 7 ▶sub push {
Subroutine push: called CC=3 SCAR=11.2
Pod documented
35 ###########################################
36 7 my($self, $text) = @_;
37  
38 7 ▶ unless(defined $text) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $text) 0 7 7
39 # Somebody called us via Log::Log4perl::NDC::push("blah") ?
40 0 $text = $self;
41 }
42  
43 7 ▶ if(@NDC_STACK >= $MAX_SIZE) {
Branch: 1 branch
BranchTrueFalseTotal
if (@Log::Log4perl::NDC::NDC_STACK >= $Log::Log4perl::NDC::MAX_SIZE) 1 6 7
44 1 CORE::pop(@NDC_STACK);
45 }
46  
47 7 return push @NDC_STACK, $text;
48 }
49  
50 ###########################################
51 1 ▶sub remove {
Subroutine remove: called CC=1 SCAR=0.0
Pod documented
52 ###########################################
53 1 @NDC_STACK = ();
54 }
55  
56 __END__
« Log4perl/Appender/Buffer.pm ↑ Summary Log4perl/Appender/TestArrayBuffer.pm »