Re: [htmltmpl] [question] efficient use of HTML::Template->new
Brought to you by:
samtregar
From: Mathew R. <mat...@re...> - 2004-04-15 07:25:00
|
If you use the caching options of H::T, then wont need to care where you = call new(), as H::T will automatically use a previously parsed version = of the template from the cache, ie. the impact of call new() on a = previously parsed template, is nearly zero. Read up on the caching options within the H::T perldoc; you should find = one of the type which would suite your application environment. regards, Mathew > Wondering if anyone has input regarding the use of: >=20 > HTML::Template->new >=20 > It would seem (to me) that from a performance standpoint, > only calling a template as it is needed is the most efficient > approach. >=20 > My question has to do with the actual impact of > HTML::Template->new >=20 > In a script, when I only use a given template one time, > I only call it in the one location where it's needed >=20 > When the template is used globally (every time the > script is fired off), I call the template at the beginning > of the script - one time. >=20 > My question has to do with templates that are potentially > used in many areas of the script, even though only once. > In other words, there may be various ways the script > can be triggered that will require a given template (and > many ways the script can be called where the template > isn't needed). >=20 > To avoid code clutter, what I'd like to do is call all my > templates in one spot: >=20 > my $temp1 =3D HTML::Template->new( etc ... > my $temp2 =3D HTML::Template->new( etc ... > my $temp3 =3D HTML::Template->new( etc ... >=20 > But my concern is that the approach would not > be "server friendly". That said, I'm thinking that the overhead > for template calls is so small, I need not be concerned. >=20 > Hopefully, some on the list can enlighten me. >=20 > Carl Hagstrom >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > = administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > _______________________________________________ > Html-template-users mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/html-template-users > |