[Catalyst] context in ::V::TT::new()
Perrin Harkins
perrin at elem.com
Tue Jul 19 20:51:27 CEST 2005
On Tue, 2005-07-19 at 12:09 +0200, KXCG Maas wrote:
> You can also supply a subroutine ref to fill in the include path using
> the Template Toolkit.
That will work.
> Todd Holbrook wrote:
>
> >I hadn't checked to see what the performance hit was, but I'll trust
> >Perrin's "don't do that".
Jesse Sheidlower saw about an order of magnitude performance difference
with Maypole when using caching, but it depends a lot on the complexity
of your templates.
> >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, @_);
> >}
That will work fine as well.
> >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.
It might not catch deletes. It does catch modifications. If deletes
happen often and you need them to be reflected immediately, you could
subclass the Template::Provider to check for that. (I think that's the
right class. Might be worth asking on the TT list to see if anyone did
this already.)
- Perrin
More information about the Catalyst
mailing list