On Tue, 2005-10-04 at 11:54 -0400, Brett Sanger wrote:
> But my concern is that I don't understand singletons and shared memory
> over multiple child processes enough to know that my output() will be an
> atomic action (at least within the scope of each method call).  Will
> this work, or will one child be modifying the config of the object when
> another child is calling it?

Okay, back up a bit.  First, you need to understand something about
mod_perl: nothing is shared between child processes.  You will have
separate Template objects and separate caches in each child.  They will
not be shared.  (Some people have found that they get a copy-on-write
memory savings by compiling the templates at startup, but that has not
made a difference for me and it isn't really sharing in the sense you're
talking about.)

You still want to use a singleton and vary the INCLUDE_PATH, because if
you just create a new Template object every time you will get no caching
and TT will be about 10 times slower.  There are tips and code samples
for doing this in the list archives, in the book, and in various CPAN
modules that use TT.  If you need help understanding them, post your
questions here.

- Perrin


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

Reply via email to