sub load_tmpl { my $self = shift; my ($tmpl_file, @extra_params) = @_; # add tmpl_path to path array of one is set, otherwise add a path arg if (my $tmpl_path = $self->tmpl_path) { my $found = 0; for( my $x = 0; $x < @extra_params; $x += 2 ) { if ($extra_params[$x] eq 'path' and ref $extra_params[$x+1] and ref $extra_params[$x+1] eq 'ARRAY') { unshift @{$extra_params[$x+1]}, $tmpl_path; $found = 1; last; } } push(@extra_params, path => [ $tmpl_path ]) unless $found; } require HTML::Template; my $t = HTML::Template->new_file($tmpl_file, @extra_params); return $t; }