Template/Container.pm

filter: Statementstmt 42.3% 11 / 26 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 3 totaltotal 33.3% 15 / 45 CC 5 SCAR 19.6
CC
5
Cov
33%
new
12.0
iterate_over_children
12.0
render
2.0
CRAP 7.1
« Template/Container/Loop.pm ↑ Summary Template/Container/KeepLeadingZeros.pm »
1 package Excel::Template::Container;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 BEGIN {
6 1 ▶ use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶ @ISA = qw(Excel::Template::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶ use Excel::Template::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 }
11  
12 # Containers are objects that can contain arbitrary elements, such as
13 # PageDefs or Loops.
14  
15 sub new
16 {
17 0 ▶ my $class = shift;
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
18 0 my $self = $class->SUPER::new(@_);
19  
20 $self->{ELEMENTS} = []
21 unless exists $self->{ELEMENTS} &&
22 0 ▶ ref $self->{ELEMENTS} eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"ELEMENTS"} and ref $self->{"ELEMENTS"} eq "ARRAY" 0 0 0
Condition0%0/3
exists $self->{"ELEMENTS"} and ref $self->{"ELEMENTS"} eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"ELEMENTS"} and ref $self->{"ELEMENTS"} eq "ARRAY"
exists $self->{"ELEMENTS"} ref $self->{"ELEMENTS"} eq "ARRAY"
Truth table0%0/3
A and B
A= exists $self->{"ELEMENTS"}B= ref $self->{"ELEMENTS"} eq "ARRAY"
ABresult
0X0
100
111
23  
24 0 return $self;
25 }
26  
27 # Removed as unused code
28 #sub _do_page
29 #{
30 # my $self = shift;
31 # my ($method, $context) = @_;
32 #
33 # for my $e (@{$self->{ELEMENTS}})
34 # {
35 # $e->enter_scope($context);
36 # $e->$method($context);
37 # $e->exit_scope($context, 1);
38 # }
39 #
40 # return 1;
41 #}
42 #
43 #sub begin_page { _do_page 'begin_page', @_ }
44 #sub end_page { _do_page 'end_page', @_ }
45  
46 sub iterate_over_children
47 {
48 0 ▶ my $self = shift;
Subroutine iterate_over_children: not called CC=3 SCAR=24.8
Pod undocumented
49 0 my ($context) = @_;
50  
51 0 my $continue = 1;
52  
53 0 for my $e (
54 0 @{$self->{ELEMENTS}})
55 {
56 0 $e->enter_scope($context);
57  
58 0 my $rc = $e->render($context);
59 0 ▶ $continue = $rc if $continue;
Branch: 1 branch
BranchTrueFalseTotal
if $continue 0 0 0
60  
61 0 $e->exit_scope($context);
62 }
63  
64 0 return $continue;
65 }
66  
67 0 ▶sub render { $_[0]->iterate_over_children($_[1]) }
Subroutine render: not called CC=1 SCAR=6.9
Pod undocumented
68 #{
69 # my $self = shift;
70 # my ($context) = @_;
71 #
72 # return $self->iterate_over_children($context);
73 #}
74  
75 # Removed as unused code
76 #sub max_of
77 #{
78 # my $self = shift;
79 # my ($context, $attr) = @_;
80 #
81 # my $max = $context->get($self, $attr);
82 #
83 # ELEMENT:
84 # foreach my $e (@{$self->{ELEMENTS}})
85 # {
86 # $e->enter_scope($context);
87 #
88 # my $v = $e->isa('CONTAINER')
89 # ? $e->max_of($context, $attr)
90 # : $e->calculate($context, $attr);
91 #
92 # $max = $v if $max < $v;
93 #
94 # $e->exit_scope($context, 1);
95 # }
96 #
97 # return $max;
98 #}
99 #
100 #sub total_of
101 #{
102 # my $self = shift;
103 # my ($context, $attr) = @_;
104 #
105 # my $total = 0;
106 #
107 # ELEMENT:
108 # foreach my $e (@{$self->{ELEMENTS}})
109 # {
110 # $e->enter_scope($context);
111 #
112 # $total += $e->isa('CONTAINER')
113 # ? $e->total_of($context, $attr)
114 # : $e->calculate($context, $attr);
115 #
116 # $e->exit_scope($context, 1);
117 # }
118 #
119 # return $total;
120 #}
121  
122 1 1;
123 __END__
« Template/Container/Loop.pm ↑ Summary Template/Container/KeepLeadingZeros.pm »