diff Lib/IMPL/Web/View/TTLoader.pm @ 343:9bdccdf1f50b

Added a templates context
author cin
date Fri, 13 Sep 2013 12:53:15 +0400
parents 86336d451b82
children 72799d1211c5
line wrap: on
line diff
--- a/Lib/IMPL/Web/View/TTLoader.pm	Wed Jul 03 03:53:12 2013 +0400
+++ b/Lib/IMPL/Web/View/TTLoader.pm	Fri Sep 13 12:53:15 2013 +0400
@@ -8,7 +8,7 @@
 use IMPL::declare {
     require => {
         Provider => 'Template::Provider',
-        Context => 'Template::Context',
+        Context => 'IMPL::Web::View::TTContext',
         TTRegistry => 'IMPL::Web::View::TTRegistry',
         TTFactory => 'IMPL::Web::View::TTFactory',
         TTDocument => '-IMPL::Web::View::TTDocument',
@@ -82,9 +82,7 @@
     
     my $opts = { %{ $this->options } };
     
-    $this->context->localise();
-    my $ctx = _clone_context($this->context);
-    $this->context->delocalise();
+    my $ctx = $this->context->clone();
     
     $ctx->stash->update($vars);
     
@@ -157,13 +155,6 @@
     }
 }
 
-sub _clone_context {
-    my $args = { %{shift || {}} };
-    delete $args->{CONFIG};
-    
-    return Template::Context->new($args);
-}
-
 1;
 
 __END__