diff options
author | franck cuny <franck@lumberjaph.net> | 2010-06-13 22:12:44 +0200 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-06-13 22:12:44 +0200 |
commit | 993f1c2271969a9f6a9a13d5c9d6ccb41100cf57 (patch) | |
tree | 7db22fbdce7cd644ccc2c14716bb32e1840315a0 | |
parent | first commit (diff) | |
download | dancer-template-declare-master.tar.gz |
add synopsis master
-rw-r--r-- | lib/Dancer/Template/Declare.pm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/Dancer/Template/Declare.pm b/lib/Dancer/Template/Declare.pm index 8816ecd..ee37aaa 100644 --- a/lib/Dancer/Template/Declare.pm +++ b/lib/Dancer/Template/Declare.pm @@ -23,3 +23,41 @@ sub render { } 1; + +=head1 SYNOPSIS + + package myapp::templates; + use Template::Declare::Tags; + use base 'Template::Declare'; + + template hello => sub { + my ($self, $vars) = @_; + html { + head { + title {"Hello, $vars->{user}"}; + }; + body { + h1 { + "Hello, $vars->{user}"; + }; + }; + }; + }; + + package myapp; + use myapp::templates; + use Dancer ':syntax'; + + get '/' => sub { + template 'hello', {user => 'marc'}; + }; + + true; + + # in your configuration: + template: declare + engines: + declare: + dispatch_to: + - myapp::template + |