Re: Speeding up H::T

Sam Tregar <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
On Tue, 27 Jun 2006, Matthew wrote:

>> Also, are you loading many templates and doing includes manually?
>> Switching to tmpl_include (which is processed at compile time) can be
>
> 	Not sure what you mean.

Some people do stuff like:

   my $header = HTML::Template->new(...);
   my $body   = HTML::Template->new(...);
   my $footer = HTML::Template->new(...);

   print $header->output, $body->output, $footer->output;

It's slower than just using tmpl_include.  I see it a lot so I thought
I'd mention it.

>     <TMPL_IF NAME="LOGIN_MENU">
>       <TMPL_INCLUDE NAME="login_menu.tpl">
>     </TMPL_IF>

This is a little strange, but I doubt it's a performance problem.
Usually each of those would be an indepenent template with:

   <tmpl_include header.tmpl>
   ... content stuff ...
   <tmpl_include footer.tmpl>

But I might be biased by using CGI::Application, which makes it really
easy for each run-mode (login_menu would be a CGI::App run-mode) to
have it's own template.

-sam

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.