[Templates] Changeing the INCLUDE_PATH
Andy Wardley
abw@cre.canon.co.uk
Tue, 15 Aug 2000 20:03:57 +0100 (BST)
> > The method for that is in the Template::Provider class. You can reach it
> > like this:
> > $tt->service->context->load_templates->[0]->include_path($include_path)
>
> I can only conclude that you are not supposed to do this.
No, you can do that. Or if you prefer, dig out the reference to
the provider early on,
my $provider = $tt->service->context->load_templates->[0];
and then fiddle around with its include_path method as you need it.
$provider->include_path(\@newpath);
Or just define the INCLUDE_PATH as a list reference that you keep a
handle on:
my $inc_path = [ "$somewhere/user/default", "$somewhere/lib/" ];
my $tt = Template->new({
INCLUDE_PATH = $inc_path,
});
...code passes...
$inc_path->[0] = "$somewhere/user/$userid";
$tt->process($somepage, $replace);
I haven't tested that last example, but it _should_ work. If it doesn't
now, you can be sure it will by tomorrow... :-)=
A