summary refs log tree commit diff
diff options
context:
space:
mode:
authorFayland Lam <fayland@gmail.com>2011-11-26 11:16:32 +0800
committerFayland Lam <fayland@gmail.com>2011-11-26 11:16:32 +0800
commit97458a0bfb9acf832990c74ff6c304cace7997f7 (patch)
treedd794c0101f1d1aec9ec3436c3cb68ce193a5f7f
parentset extension when suffix is set (diff)
downloaddancer-template-xslate-97458a0bfb9acf832990c74ff6c304cace7997f7.tar.gz
fix for app.psgi load dancer app
-rw-r--r--lib/Dancer/Template/Xslate.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Dancer/Template/Xslate.pm b/lib/Dancer/Template/Xslate.pm
index ed26c4a..94d0fec 100644
--- a/lib/Dancer/Template/Xslate.pm
+++ b/lib/Dancer/Template/Xslate.pm
@@ -6,7 +6,6 @@ use strict;
 use warnings;
 
 use Text::Xslate;
-use Dancer::Config 'setting';
 
 use base 'Dancer::Template::Abstract';
 
@@ -23,11 +22,13 @@ sub init {
 
     ## set default path for header/footer etc.
     $args{path} ||= [];
-    my $view_dir = setting('views');
+    my $view_dir = Dancer::App->current->setting('views');
     push @{$args{path}}, $view_dir unless grep { $_ eq $view_dir } @{$args{path}};
     
     ## for those people read Text::Xslate instead of Dancer::Template::Abstract
     $self->config->{extension} = $args{suffix} if exists $args{suffix};
+    # avoid 'Text::Xslate: Unknown option(s): extension'
+    $args{suffix} = delete $args{extension}    if exists $args{extension};
     
     $_engine = Text::Xslate->new(%args);
 }
@@ -36,7 +37,7 @@ sub render {
     my ($self, $template, $tokens) = @_;
     
     # absolute filename will never work under Windows even we hard set path as ['/']
-    my $view_dir = setting('views');
+    my $view_dir = Dancer::App->current->setting('views');
     $template =~ s/^\Q$view_dir\E//;
 
     my $content = eval {