1 package Excel::Template::Container;
7 @ISA = qw(Excel::Template::Base);
9 use Excel::Template::Base;
12 # Containers are objects that can contain arbitrary elements, such as
18 my $self = $class->SUPER::new(@_);
20 $self->{ELEMENTS} = [] unless UNIVERSAL::isa($self->{ELEMENTS}, 'ARRAY');
28 my ($method, $context) = @_;
30 for my $e (@{$self->{ELEMENTS}})
32 $e->enter_scope($context);
33 $e->$method($context);
34 $e->exit_scope($context, 1);
40 sub begin_page { _do_page 'begin_page', @_ }
41 sub end_page { _do_page 'end_page', @_ }
43 sub iterate_over_children
53 $e->enter_scope($context);
55 my $rc = $e->render($context);
56 $continue = $rc if $continue;
58 $e->exit_scope($context);
64 sub render { $_[0]->iterate_over_children($_[1]) }
69 # return $self->iterate_over_children($context);
75 my ($context, $attr) = @_;
77 my $max = $context->get($self, $attr);
80 foreach my $e (@{$self->{ELEMENTS}})
82 $e->enter_scope($context);
84 my $v = $e->isa('CONTAINER')
85 ? $e->max_of($context, $attr)
86 : $e->calculate($context, $attr);
88 $max = $v if $max < $v;
90 $e->exit_scope($context, 1);
99 my ($context, $attr) = @_;
104 foreach my $e (@{$self->{ELEMENTS}})
106 $e->enter_scope($context);
108 $total += $e->isa('CONTAINER')
109 ? $e->total_of($context, $attr)
110 : $e->calculate($context, $attr);
112 $e->exit_scope($context, 1);
123 Excel::Template::Container
143 Rob Kinyon (rob.kinyon@gmail.com)