Re: Is the object loaded by the USE directive cached between requests?

Chris Herdt <[email protected]> Tue, 12 May 2015 10:39:27 -0400
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <CAFUsNGKb0=_gbvnwNJWuh940qqsUbP=FDVL_j12HrpiH3oCdsg@mail.gmail.com>
--===============7168964716854371206==
Content-Type: multipart/alternative; boundary=089e011838902a70c70515e376c7

--089e011838902a70c70515e376c7
Content-Type: text/plain; charset=UTF-8

On Tue, May 12, 2015 at 10:10 AM, Randal L. Schwartz <[email protected]>
wrote:

> But at another client, my quick solution was to change:
>
>   my $template = Template->new(...);
>
> into
>
>   our $template ||= Template->new(...);
>
> This works as long as there are no per-hit variables being passed into
> the constructor.  Generally those are passed into ->template instead.


I'd seen examples of that in the list archive and was hopeful that it be
the answer to the speed issue. Unfortunately, there are some per-hit
variables passed to the constructor. Although on closer inspection I wonder
if they really need to be passed to the constructor. I'll take a look at
that.

Thanks for all the info--I appreciate it!

-- 
Chris Herdt
Web Applications Developer
http://osric.com/chris/

--089e011838902a70c70515e376c7
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T=
ue, May 12, 2015 at 10:10 AM, Randal L. Schwartz <span dir=3D"ltr">&lt;<a h=
ref=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
m</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margi=
n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">But at another cl=
ient, my quick solution was to change:<br>
<br>
=C2=A0 my $template =3D Template-&gt;new(...);<br>
<br>
into<br>
<br>
=C2=A0 our $template ||=3D Template-&gt;new(...);<br>
<br>
This works as long as there are no per-hit variables being passed into<br>
the constructor.=C2=A0 Generally those are passed into -&gt;template instea=
d.</blockquote><div><br></div><div>I&#39;d seen examples of that in the lis=
t archive and was hopeful that it be the answer to the speed issue. Unfortu=
nately, there are some per-hit variables passed to the constructor. Althoug=
h on closer inspection I wonder if they really need to be passed to the con=
structor. I&#39;ll take a look at that.</div><div><br></div><div>Thanks for=
 all the info--I appreciate it!</div></div><div><br></div>-- <br><div class=
=3D"gmail_signature">Chris Herdt<br>Web Applications Developer<br><a href=
=3D"http://osric.com/chris/" target=3D"_blank">http://osric.com/chris/</a><=
/div>
</div></div>

--089e011838902a70c70515e376c7--


--===============7168964716854371206==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

--===============7168964716854371206==--