Lyle Brooks <[EMAIL PROTECTED]> said something to this effect on 01/24/2002:
> Quoting darren chamberlain ([EMAIL PROTECTED]):
> I agree that such a iteration would be needed if LOAD_TEMPLATES
> contained multiple objects.
> 
> I'd be interested to know if anyone actually uses TT2 where the
> LOAD_TEMPLATES data member contains an array ref of
> Template::Provider objects and/or objects that have been
> sub-classed from Template::Provider
> 
> I've looked at this and found it challenging to wrap my brain
> around it (notwithstanding that the documentation says you
> should be able to do that in theory).

Right, I agree, but if we're discussing patching TT to allow
modifying the INCLUDE_PATH of each of the list of Template::Provider
instances, we need to make sure that we deal with a list, even
if that list most commonly has only one element.

I've gotten around that using this kind of code in my
Template::Service subclasses' _init method:

    my $provider = Template::Config->provider($config);
    $config->{'LOAD_TEMPLATES'} = $provider;
    $self->SUPER::_init($config);

    *include_path = sub {  
        my ($self, $filename) = @_;
        my $paths = $self->_inc_path($filename);
        $self->provider->include_path($paths);
    };
    
    *provider = sub { $provider };

Hackish, but it gets the job done (_inc_path is the one that got
added into Apache::Template).

And, BTW, I've never used multiple Providers.

(darren)

-- 
Men are from earth. Women are from earth. Deal with it.


Reply via email to