summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Simões <rsimoes@cpan.org>2011-12-09 10:16:04 -0600
committerRichard Simões <rsimoes@cpan.org>2011-12-09 10:16:04 -0600
commitac212f86d8ff9d10a3aa8cd097782aa8bc009236 (patch)
tree920d286fe893b88555914ecb41896d6d520dbace
parentadd dzil plugins, use File::Spec exclusively instead of regular expressions (diff)
downloaddancer-template-xslate-ac212f86d8ff9d10a3aa8cd097782aa8bc009236.tar.gz
fix Changes date, remove unecessary usage of $self->config
-rw-r--r--Changes2
-rw-r--r--lib/Dancer/Template/Xslate.pm12
2 files changed, 6 insertions, 8 deletions
diff --git a/Changes b/Changes
index 1a9b490..799eb2b 100644
--- a/Changes
+++ b/Changes
@@ -6,5 +6,5 @@ Revision history for Dancer-Template-Xslate
      - fix MS Windows pathing bug
      - don't use Dancer::Config directly
 
-0.01 Mon 02 Aug 2010 12:23:50 PM CEST
+0.01 Mon 2010-08-02 12:23:50 CEST
      - initial release
diff --git a/lib/Dancer/Template/Xslate.pm b/lib/Dancer/Template/Xslate.pm
index 203089d..a5e21c1 100644
--- a/lib/Dancer/Template/Xslate.pm
+++ b/lib/Dancer/Template/Xslate.pm
@@ -19,18 +19,17 @@ use base 'Dancer::Template::Abstract';
 
 sub init {
     my ($self) = @_;
-    my $config = $self->config;
     my $app    = Dancer::App->current;
-    my %xslate_args = %{$config};
+    my %xslate_args = %{$self->config};
 
     ## set default path for header/footer etc.
     $xslate_args{path} ||= [];
-    my $views_dir = $config->{views_dir} = $app->setting('views');
+    my $views_dir = $app->setting('views');
     push @{$xslate_args{path}}, $views_dir
         if not grep { $_ eq $views_dir } @{$xslate_args{path}};
 
     ## for those who read Text::Xslate instead of Dancer::Template::Abstract
-    $config->{extension} = $xslate_args{suffix}
+    $self->config->{extension} = $xslate_args{suffix}
         if exists $xslate_args{suffix};
 
     ## avoid 'Text::Xslate: Unknown option(s): extension'
@@ -43,9 +42,8 @@ sub init {
 
 sub render {
     my ($self, $template, $tokens) = @_;
-    my $config = $self->config;
-
-    my $views_dir = $self->config->{views_dir};
+    my $app    = Dancer::App->current;
+    my $views_dir = $app->setting('views');
     (undef, undef, $template) = splitpath $template if $views_dir;
     my $xslate = $self->{driver};
     my $content = $xslate->render($template, $tokens);