[Catalyst] context in ::V::TT::new()

Todd Holbrook paradawks at gmail.com
Tue Jul 19 00:52:27 CEST 2005


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



More information about the Catalyst mailing list