Fagyal Csongor wrote: > BTW, it would be nice to have something like a > Template::Provider::_preprocess ()
Yep, there probably should be a hook in there for that kind of thing. However, the TT2 provider implementation is Totally Not Good and has been thrown away in favour of a complete re-write for TT3. So I'm loathed to go back and make any feature changes to code that will eventually be slain. For now the best thing is to subclass the module and add your own hook to the _load() method. My apologies in advance for the fact that T::Provider is so damn hard to subclass cleanly. That's another thing that I've fixed for TT3. > And another thing. Is there a mechanism to preload a list of templates > into Template.pm? I have an application server that uses TT, and as far > as I know, templates are (???) cached in $self, which is not very > efficient in my case as all forked children have their separate copies > of the compiled code. The usual approach is to create one Template object, assign it to a package variable (e.g. $My::App::Template) in the parent process and have all the children use it. That way you have one object and one memory cache. You can also look into the COMPILE_DIR and/or COMPILE_EXT options which allow you to share pre-compiled templates between distinct processes. They'll still have their own copies of the in-memory compiled templates, but you can limit the CACHE_SIZE to keep that small and still get good performance by avoiding the more time consuming process of compiling templates the first time around. HTH A _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates
