Hi,

I'm using TT2 under mod_perl and wish to use the in-memory
template caching across requests.  The include path may vary between
requests (to allow overriding) as may the parameters to "new".

Given these requirements, my strategy is to keep a provider
(and its cache) across requests and reset the include_path
as required.  
Does it correctly cache and find the correct file for the path?
Is there a better/simpler way to achieve this?

The relevant bits of the handler are something like:

my $tt_provider;

sub handler {
    ...

    $tt_provider ||= Template::Config->provider();   
    $tt_provider->include_path( [EMAIL PROTECTED] );
    my $tt = Template->new(
            LOAD_TEMPLATES => $tt_provider,
            %per_deployment_args,
            # I guess Provider params are just ignored (?)
        ) or die "Can't Template->new $Template::ERROR";

    ...
    $tt->process(...);
}

Thanks, Brad

-- 
 Learning is a good thing.  But more often it leads to mistakes. ...
 For the most part we admire of our own opinions and become fond of arguing.
                                    -- Hagakure http://bereft.net/hagakure/



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

Reply via email to