
boy.maasatgmail.com
Jul 19, 2005, 12:07 PM
Post #7 of 12
(381 views)
Permalink
|
You can also supply a subroutine ref to fill in the include path using the Template Toolkit. This subroutine can use fe a package variable to supply a per request include path. my @INC_TT; sub set_inc_path { @INC_TT = @_ } sub get_inc_path { \@INC_TT } __PACKAGE__->config( DEBUG => Battles->debug ? DEBUG_PROVIDER : undef, INCLUDE_PATH => [ \&get_inc_path ] ); -Boy Todd Holbrook wrote: >I hadn't checked to see what the performance hit was, but I'll trust >Perrin's "don't do that". I'm not sure if access to WRAPPER is >available in the same way, but this seems to work for my INCLUDE_PATH >problem. It's probably not the "right" solution, but after attempting >to search the various mail lists without coming up with a definitive >solution I went with this (which is basically stolen from >CGI::Application::Plugin::TT). If someone does have a definitive >solution, I (and others, I'm sure) would love to see it on the wiki. > >In App::View::TT which uses Catalyst::View::TT as a base: > >sub process { > my $self = shift; > my $c = shift; > my $root = $c->config->{root}; > $self->template->context->load_templates->[0]->include_path([$c->stash->{extra_include_dir}, >$root, "$root/base"]); > $self->SUPER::process($c, @_); >} > >Actually, after preparing this I discovered I may not be able to use >this after all without doing some other changes as it doesn't pick up >when a template has been deleted. I guess it keeps serving it out of >a cache. Unfortunately my application has a separate maintenance >system that allows (trusted) administrators to modify/delete templates >using a web tool. >-- >Todd Holbrook >Systems Consultant >Simon Fraser University > >_______________________________________________ >Catalyst mailing list >Catalyst [at] lists >http://lists.rawmode.org/mailman/listinfo/catalyst > > >
|