summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-06-13 22:12:44 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-13 22:12:44 +0200
commit993f1c2271969a9f6a9a13d5c9d6ccb41100cf57 (patch)
tree7db22fbdce7cd644ccc2c14716bb32e1840315a0
parentfirst commit (diff)
downloaddancer-template-declare-master.tar.gz
add synopsis master
-rw-r--r--lib/Dancer/Template/Declare.pm38
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
+