X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FView%2FTT.pm;h=40fa5651dcc9480db76f856e5f1a0a40e8aeb44b;hb=8617321ebf13ce6b63d41a65a003d153f2b5cc5e;hp=042a1b5824da5e0cd16921c6da0920fa9386d78b;hpb=24259799350483f32219fd3755e0bed54f909c54;p=maypole.git diff --git a/lib/Maypole/View/TT.pm b/lib/Maypole/View/TT.pm index 042a1b5..40fa565 100644 --- a/lib/Maypole/View/TT.pm +++ b/lib/Maypole/View/TT.pm @@ -10,13 +10,20 @@ our $VERSION = "1." . sprintf "%04d", q$Rev$ =~ /: (\d+)/; sub template { my ( $self, $r ) = @_; - my $view_options = $r->config->view_options || {}; - $self->{provider} ||= Template::Provider->new(); - $self->{tt} ||= Template->new({ - COMPILE_DIR => catdir(tmpdir(), $r->config->application_name), - %$view_options, - LOAD_TEMPLATES => [ $self->{provider} ], - }); + unless ($self->{tt}) { + my $view_options = $r->config->view_options || {}; + (my $driver_name = ref $r) =~ s/::/_/g; + my $compile_dir = catdir(tmpdir(), $driver_name); + $self->{provider} = Template::Provider->new( + COMPILE_DIR => $compile_dir, + %$view_options, + ); + $self->{tt} = Template->new({ + COMPILE_DIR => $compile_dir, + %$view_options, + LOAD_TEMPLATES => [ $self->{provider} ], + }); + } $self->{provider}->include_path([ $self->paths($r) ]);