On Wed, 21 Nov 2001, Johnson Colin (KnowledgePool) wrote:
> I am trying to setup our web server to use only one template object (created
> at startup), rather than creating a template object per request
An admirable goal.
> (I've had to ignore things like 'memoize' which look like they do
> deeper magic than I am capable of).
Memoize doesn't really apply here unless you want to cache
template output.
> # set some per-request template configuration options
> my $service = $template->service();
> $service->{ PRE_PROCESS } = ['default_config', 'this_request_config'];
>
> I then have to use service to deliver the output to get the new
> configurations option to be used
That doesn't seem right. When you use $template->process() it doesn't use
the new PRE_PROCESS setting?
> This seems to be doing what I want it to do but I'm particularly unsure
> about whether I could get into problems with a simultaneous request using
> the same template object. Could I ever get the wrong template being
> pre-processed for a request because I have set it differently on another
> request?
With mod_perl, each request is handled by a separate process and the
$template object is unique to each process. Your settings in one process
have no effect on other processes.
- Perrin