summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRichard Simões <rsimoes@cpan.org>2011-12-10 08:49:32 -0600
committerRichard Simões <rsimoes@cpan.org>2011-12-10 08:49:32 -0600
commit856b77b1de406485be304924955c4a19fca6d435 (patch)
treef787a2a6b7e523904ab912a0a79e9519b6413735 /lib
parentfix Changes date, remove unecessary usage of $self->config (diff)
downloaddancer-template-xslate-856b77b1de406485be304924955c4a19fca6d435.tar.gz
better approach to setting relative path of template
Diffstat (limited to '')
-rw-r--r--lib/Dancer/Template/Xslate.pm5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Dancer/Template/Xslate.pm b/lib/Dancer/Template/Xslate.pm
index a5e21c1..c18aec2 100644
--- a/lib/Dancer/Template/Xslate.pm
+++ b/lib/Dancer/Template/Xslate.pm
@@ -6,7 +6,7 @@ use warnings;
use Carp;
use Dancer::App;
-use File::Spec::Functions qw(splitpath);
+use File::Spec::Functions qw(abs2rel rel2abs);
use Text::Xslate;
use base 'Dancer::Template::Abstract';
@@ -43,8 +43,7 @@ sub init {
sub render {
my ($self, $template, $tokens) = @_;
my $app = Dancer::App->current;
- my $views_dir = $app->setting('views');
- (undef, undef, $template) = splitpath $template if $views_dir;
+ $template = abs2rel( rel2abs($template), $app->setting('views') );
my $xslate = $self->{driver};
my $content = $xslate->render($template, $tokens);