Andy Wardley <[EMAIL PROTECTED]> said something to this effect on 11/08/2001:
> On Thu, Nov 08, 2001 at 12:56:47AM -0500, Chris Winters wrote:
> > I know I'm going to sound like a dope here, but whatever. I had no
> > idea you could modify INCLUDE_PATH with each *request*
> [...]
> > So how do you do it?
>
> my $inc = [ 'b', 'c', 'd' ];
> my $tt2 = Template->new( INCLUDE_PATH => $inc );
>
> ...later, that same day....
>
> unshift($inc, 'a');
>
> Also, the Template::Provider has an include_path() method for accessing
> or updating the INCLUDE_PATH. Of course, the provider is a little hard to
> come by, you have to do something like this:
>
> my $prov = $tt2->context->{ LOAD_TEMPLATES }->[0];
>
> and then:
>
> $prov->include_path([ qw( new include path) ]);
I do something similar in my Template::Service subclass's _init
method:
my $provider = Template::Config->provider($config)
$config->{'LOAD_TEMPLATES'} = $provider;
$self->SUPER::_init($config);
...
*provider = sub { $provider };
So I can call $service->provider to get at the provider instance
without having to fiddle with the internals, and each new
Template::Service object's provider method returns the correct
provider instance..
(darren)
--
It's not that things are getting worse, it's just that news reporting is
getting better.