Is there a way to globally set the HTML::Template options when usingCGI::Application? TMPL_PATH allows you to set the template directory, but there are other application-wide setting like caching etc that I would liketo set, but don't want to do it eveytime I call load_tmpl
You can have a method in your CGI::Application class that calls load_tmpl
with the appropriate parameters. You then call this method instead of load_tmpl.You could even give it the same name "load_tmpl" to avoid having to change
existing code but I find this confusing.
I always have a prepare_tmpl that looks like this:
sub prepare_tmpl{
my ($self, $name, @extras) = @_;
my $cache = 'cache';
$cache = 'shared_cache' if $IPC::SharedCache::VERSION;
my $tmpl = $self->load_tmpl($name,
die_on_bad_params => 0,
loop_context_vars => 1,
global_vars => 1,
$cache => 1,
);
$tmpl->param(@extras) if @extras;
return $tmpl;
}
Cheers,
Thilo
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.