| 1 | package Excel::Template::Container::Loop; | ||||||||||||||||||||||||||||
| 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::Container); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Excel::Template::Container; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | sub new | ||||||||||||||||||||||||||||
| 13 | { | ||||||||||||||||||||||||||||
| 14 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 0 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | ▶ | if (exists $self->{MAXITERS} && $self->{MAXITERS} < 1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $self->{"MAXITERS"} and $self->{"MAXITERS"} < 1
MC/DC0%0/2
exists $self->{"MAXITERS"} and $self->{"MAXITERS"} < 1
exists $self->{"MAXITERS"}
$self->{"MAXITERS"} < 1
Truth table0%0/3
A and B
A= exists $self->{"MAXITERS"}B= $self->{"MAXITERS"} < 1
| |||||||||||||||||||||||||||||
| 18 | { | ||||||||||||||||||||||||||||
| 19 | 0 | die "<loop> MAXITERS must be greater than or equal to 1", $/; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | else | ||||||||||||||||||||||||||||
| 22 | { | ||||||||||||||||||||||||||||
| 23 | 0 | $self->{MAXITERS} = 0; | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | return $self; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | sub _make_iterator | ||||||||||||||||||||||||||||
| 30 | { | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_make_iterator: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 32 | 0 | my ($context) = @_; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | return Excel::Template::Factory->_create('ITERATOR', | |||||||||||||||||||||||||||
| 35 | NAME => $context->get($self, 'NAME'), | ||||||||||||||||||||||||||||
| 36 | MAXITERS => $context->get($self, 'MAXITERS'), | ||||||||||||||||||||||||||||
| 37 | CONTEXT => $context, | ||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | sub render | ||||||||||||||||||||||||||||
| 42 | { | ||||||||||||||||||||||||||||
| 43 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
render: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | 0 | my ($context) = @_; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | unless ($self->{ITERATOR} && $self->{ITERATOR}->more_params) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"ITERATOR"} and $self->{"ITERATOR"}->more_params
MC/DC0%0/2
$self->{"ITERATOR"} and $self->{"ITERATOR"}->more_params
$self->{"ITERATOR"}
$self->{"ITERATOR"}->more_params
Truth table0%0/3
A and B
A= $self->{"ITERATOR"}B= $self->{"ITERATOR"}->more_params
| |||||||||||||||||||||||||||||
| 47 | { | ||||||||||||||||||||||||||||
| 48 | 0 | $self->{ITERATOR} = $self->_make_iterator($context); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | 0 | my $iterator = $self->{ITERATOR}; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | $iterator->enter_scope; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | ▶ | while ($iterator->can_continue) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | { | ||||||||||||||||||||||||||||
| 56 | 0 | $iterator->next; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | $self->iterate_over_children($context); | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | # It doesn't seem that iterate_over_children() can ever fail, because | ||||||||||||||||||||||||||||
| 61 | # I'm not sure that render() can return false. In PDF::Template, where | ||||||||||||||||||||||||||||
| 62 | # this module got most of its code, render() can certainly return false, | ||||||||||||||||||||||||||||
| 63 | # in the case of page-breaks. I left the code in because it didn't seem | ||||||||||||||||||||||||||||
| 64 | # like it would hurt. | ||||||||||||||||||||||||||||
| 65 | #unless ($self->iterate_over_children($context)) | ||||||||||||||||||||||||||||
| 66 | #{ | ||||||||||||||||||||||||||||
| 67 | # $iterator->back_up; | ||||||||||||||||||||||||||||
| 68 | # last; | ||||||||||||||||||||||||||||
| 69 | #} | ||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | $iterator->exit_scope; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | ▶ | return 0 if $iterator->more_params; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | return 1; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | # These methods are used in PDF::Template to calculate pagebreaks. I'm not sure | ||||||||||||||||||||||||||||
| 80 | # if they will ever be needed in Excel::Template. | ||||||||||||||||||||||||||||
| 81 | #sub total_of | ||||||||||||||||||||||||||||
| 82 | #{ | ||||||||||||||||||||||||||||
| 83 | # my $self = shift; | ||||||||||||||||||||||||||||
| 84 | # my ($context, $attr) = @_; | ||||||||||||||||||||||||||||
| 85 | # | ||||||||||||||||||||||||||||
| 86 | # my $iterator = $self->_make_iterator($context); | ||||||||||||||||||||||||||||
| 87 | # | ||||||||||||||||||||||||||||
| 88 | # my $total = 0; | ||||||||||||||||||||||||||||
| 89 | # | ||||||||||||||||||||||||||||
| 90 | # $iterator->enter_scope; | ||||||||||||||||||||||||||||
| 91 | # while ($iterator->can_continue) | ||||||||||||||||||||||||||||
| 92 | # { | ||||||||||||||||||||||||||||
| 93 | # $iterator->next; | ||||||||||||||||||||||||||||
| 94 | # $total += $self->SUPER::total_of($context, $attr); | ||||||||||||||||||||||||||||
| 95 | # } | ||||||||||||||||||||||||||||
| 96 | # $iterator->exit_scope; | ||||||||||||||||||||||||||||
| 97 | # | ||||||||||||||||||||||||||||
| 98 | # return $total; | ||||||||||||||||||||||||||||
| 99 | #} | ||||||||||||||||||||||||||||
| 100 | # | ||||||||||||||||||||||||||||
| 101 | #sub max_of | ||||||||||||||||||||||||||||
| 102 | #{ | ||||||||||||||||||||||||||||
| 103 | # my $self = shift; | ||||||||||||||||||||||||||||
| 104 | # my ($context, $attr) = @_; | ||||||||||||||||||||||||||||
| 105 | # | ||||||||||||||||||||||||||||
| 106 | # my $iterator = $self->_make_iterator($context); | ||||||||||||||||||||||||||||
| 107 | # | ||||||||||||||||||||||||||||
| 108 | # my $max = $context->get($self, $attr); | ||||||||||||||||||||||||||||
| 109 | # | ||||||||||||||||||||||||||||
| 110 | # $iterator->enter_scope; | ||||||||||||||||||||||||||||
| 111 | # while ($iterator->can_continue) | ||||||||||||||||||||||||||||
| 112 | # { | ||||||||||||||||||||||||||||
| 113 | # $iterator->next; | ||||||||||||||||||||||||||||
| 114 | # my $v = $self->SUPER::max_of($context, $attr); | ||||||||||||||||||||||||||||
| 115 | # | ||||||||||||||||||||||||||||
| 116 | # $max = $v if $max < $v; | ||||||||||||||||||||||||||||
| 117 | # } | ||||||||||||||||||||||||||||
| 118 | # $iterator->exit_scope; | ||||||||||||||||||||||||||||
| 119 | # | ||||||||||||||||||||||||||||
| 120 | # return $max; | ||||||||||||||||||||||||||||
| 121 | #} | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 1 | 1; | |||||||||||||||||||||||||||
| 124 | __END__ | ||||||||||||||||||||||||||||