Randal,

thanks a lot for your fast and really helpful answer.
CACHE_SIZE is not defined within my config, so it should be set to undef.
I have set the COMPILE DIR and have the compiled templates already written
to disk on the web server.

The one thing I have to figure out now, is how to manage the global varialbe
thing. To be honest, I have never heard about the Apache::Registry hack, I
just pop in all of my regular CGI files in a mod_perl environment and don´t
really have any special codes for mod_perl execution. Are there any
resources on this, that I should study?

I tried the thing with the lexically scoped "our" varialbe snippet
equivalent to your suggestion, but it seems like the template object is
still created on each hit (it appears from the performance I am encountering
- I discover no speed up whatsoever and trace statements put into the
constructor also give me the same information, that the template object is
still created on each call) and the compiled templates are written to disk
freshly on each new creation. Unfortunately the compiled templates alwways
get the same dates whenever written to disk, so i can´t finally say whether
they are really newly created on each hit.
Is there any way to set the date on those compiled template files to their
creation date on disk? This would help me in my debugging encounters.

Thanks for your time.



2007/7/16, Randal L. Schwartz <[EMAIL PROTECTED]>:

>>>>> "Andrew" == Andrew Light <[EMAIL PROTECTED]> writes:

Andrew> I am currently running my web-app under mod_perl, but as far as I
can
Andrew> see, none of the dynamic pages, put together using the TT is being
Andrew> chached.

a) Don't create the Template object on each hit.
b) Be sure CACHE_SIZE is undef, or set to a high value.
c) Set COMPILE_DIR to some place that the web process can write.

Step "a" is easy to get wrong, if you're converting CGI code to simply
using the Apache::Registry hack.  Be sure you have something like:

      our $engine ||= Template->new(...);

rather than:

      my $engine = Template->new(...);

which is how it would typically be written in CGI.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!

Reply via email to