* Dave Hodgkinson <[EMAIL PROTECTED]> [2002-06-07 08:23]:
> darren chamberlain <[EMAIL PROTECTED]> writes:
> 
> > Also, keep in mind that many of the configuration directives can be
> > modified for each request, by e.g., .htaccess files.  This makes it very
> > difficult to share objects.
> 
> Naive question: can't the template object be stored in a per-server
> area?

Good question.  My answer, ripped straight from my code:

    #
    # This caches the service objects per virtual server in %SERVICES.
    # My experience has been that Template::Service instances shared
    # across virtual hosts tend to lead to segmentation faults.
    # 
    my $config = Apache::ModuleConfig->get($r);
    $service = $SERVICES{$r->get_server_name} ||= Apache::TT2::Service->new($config);

(%SERVICES is a package-scoped lexical which holds Service instances,
Apache::TT2 is the module, and Apache::TT2::Service is the
Template::Service subclass.)

(darren)

-- 
I have to think hard to name an interesting man who does not
drink.
    -- Richard Burton


Reply via email to