On Tue, 2005-01-04 at 21:39 -0500, Cees Hek wrote:
> It might boost performance, but it can also have unexpected
> consequences.  If I am running several different applications on the
> same mod_perl server, then the TT singleton is going to be configured
> by the first app that is executed, even though the apps may have
> significantly different configuration options.

Store it in an application-specific namespace then, so that each app has
a separate one but all are cached.

> I can definately see the benefits of singletons though, and I'll see
> about making it a configuration option.  That would at least leave it
> up to the developer to decide whether it would be a benefit.

I can't stress enough that this really makes a difference.  By creating
a new object every time, you are breaking TT's caching system.  It has
to compile the perl code for each template used on every single request.
It's almost as bad as the difference between CGI and PersistentPerl.

> > I think so, since I assume that people will either not change it or
> > change it on every request.
> 
> Again, that would be fine in a single application (assuming there is
> some consistency in the code), but can get you into trouble if you
> have several applications that don't all manually set the
> INCLUDE_PATH.  Although, I guess that can be solved through clear
> documentation.

If you keep a separate template object per app and that will take care
of this issue too.

- Perrin 




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

Reply via email to