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

Chris Herdt <[email protected]> Tue, 12 May 2015 09:31:07 -0400
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <CAFUsNGKMFz+y2=vwgg6ZrP5kvwZ=LQZRaq3EnXTE8uoUNb_ygw@mail.gmail.com>
--===============6565900190445173603==
Content-Type: multipart/alternative; boundary=047d7bd6bd96cb4db30515e2815f

--047d7bd6bd96cb4db30515e2815f
Content-Type: text/plain; charset=UTF-8

Environment details:
Apache 2.2.22
Perl 5.14.2
mod_perl2 2.000007

A lot of modules are loaded, including the Util.pm in question, by the
Apache config via a PerlRequire directive.

Template->new is called once on each request. Sounds like that's the key.


Thanks!


On Mon, May 11, 2015 at 7:03 PM, Randal L. Schwartz <[email protected]>
wrote:

> >>>>> "Chris" == Chris Herdt <[email protected]> writes:
>
> Chris> Does the USE directive load a new instance of the object per
> Chris> request? Or is it cached?
>
> First, let's back up a step.  Is this in mod_perl?  Are you loading all
> the code in the parent process, or once per child process?
>
> And most importantly, are you initiating your Template->new object only
> *once* per child lifecycle?  If you toss that and recreate it on each
> hit, you lose *all* prior knowledge.
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
> 0095
> <[email protected]> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix consulting, Technical writing, Comedy, etc. etc.
> Still trying to think of something clever for the fourth line of this .sig
>



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

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

<div dir=3D"ltr"><div>Environment details:</div>Apache 2.2.22<br><div>Perl =
5.14.2</div><div>mod_perl2 2.000007</div><div><br></div><div>A lot of modul=
es are loaded, including the Util.pm in question, by the Apache config via =
a PerlRequire directive.</div><div><br></div><div>Template-&gt;new is calle=
d once on each request. Sounds like that&#39;s the key.</div><div><br></div=
><div><br></div><div class=3D"gmail_extra">Thanks!</div><div class=3D"gmail=
_extra"><br></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote"=
>On Mon, May 11, 2015 at 7:03 PM, Randal L. Schwartz <span dir=3D"ltr">&lt;=
<a href=3D"mailto:[email protected]" target=3D"_blank">merlyn@stoneheng=
e.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"m=
argin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">&gt;&gt;&gt;&=
gt;&gt; &quot;Chris&quot; =3D=3D Chris Herdt &lt;<a href=3D"mailto:cherdt@g=
mail.com">[email protected]</a>&gt; writes:<br>
<br>
Chris&gt; Does the USE directive load a new instance of the object per<br>
Chris&gt; request? Or is it cached?<br>
<br>
First, let&#39;s back up a step.=C2=A0 Is this in mod_perl?=C2=A0 Are you l=
oading all<br>
the code in the parent process, or once per child process?<br>
<br>
And most importantly, are you initiating your Template-&gt;new object only<=
br>
*once* per child lifecycle?=C2=A0 If you toss that and recreate it on each<=
br>
hit, you lose *all* prior knowledge.<br>
<span class=3D"HOEnZb"><font color=3D"#888888"><br>
--<br>
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - <a href=3D"tel:=
%2B1%20503%20777%200095" value=3D"+15037770095">+1 503 777 0095</a><br>
&lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; =
&lt;URL:<a href=3D"http://www.stonehenge.com/merlyn/" target=3D"_blank">htt=
p://www.stonehenge.com/merlyn/</a>&gt;<br>
Perl/Unix consulting, Technical writing, Comedy, etc. etc.<br>
Still trying to think of something clever for the fourth line of this .sig<=
br>
</font></span></blockquote></div><br><br clear=3D"all"><div><br></div>-- <b=
r><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/c=
hris/</a></div>
</div></div>

--047d7bd6bd96cb4db30515e2815f--


--===============6565900190445173603==
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

--===============6565900190445173603==--