Skip to content

Commit

Permalink
Merge branch 'master' of http://github.com/shomodj/Dancer
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis Sukrieh committed Sep 24, 2010
2 parents 9c9d8ed + 8e747e0 commit 4441646
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/Dancer/Template/Abstract.pm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ be done before the template engine is used.
The base class provides a plain init() method that only returns true.
=item B<default_tmpl_ext()>
Template class that inherits this class should override this method to return a default template
extension, example: for Template::Toolkit it returns "tt" and for HTML::Mason it returns "mason".
So when you call C<template 'index';> in your dispatch code, Dancer will look for a file 'index.tt'
or 'index.mason' based on the template you use.
Note 1: when returning the extension string, please do not add a dot in front of the extension
as Dancer will do that.
Note 2: for backwords compatibility abstract class returns "tt" instead of throwing
an exception 'method not implemented'.
=item B<view($view)>
The default behavior of this method is to return the path of the given view.
Expand Down
4 changes: 3 additions & 1 deletion t/10_template/02_abstract_class.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Test::More tests => 2;
use Test::More tests => 3;
use strict;
use warnings;

Expand All @@ -8,3 +8,5 @@ my $a = Dancer::Template::Abstract->new;
eval { $a->render };
like $@, qr/render not implemented/, "cannot call abstract method render";
is $a->init, 1, "default init returns 1";

is $a->default_tmpl_ext, "tt";

0 comments on commit 4441646

Please sign in to comment.