[Jifty-commit] r5127 - talks/talks

Jifty commits jifty-commit at lists.jifty.org
Sat Feb 16 21:55:19 EST 2008


Author: sartak
Date: Sat Feb 16 21:55:19 2008
New Revision: 5127

Modified:
   talks/talks/frozen-perl.2008.txt

Log:
The talk as I gave it

Modified: talks/talks/frozen-perl.2008.txt
==============================================================================
--- talks/talks/frozen-perl.2008.txt	(original)
+++ talks/talks/frozen-perl.2008.txt	Sat Feb 16 21:55:19 2008
@@ -64,6 +64,37 @@
 ---
 Templates = methods
 ---
+Refactoring
+---
+#title Ideology - refactoring
+#mode perl
+template 'whats-for-dinner' => sub {
+    h1 { "Choose wisely!" }
+    div {
+        class is "item";
+        h2 { "Chicken" }
+    }
+    div {
+        class is "item";
+        h2 { "Salmon" }
+    }
+};
+---
+#mode perl
+template 'whats-for-dinner' => sub {
+    h1 { "Choose wisely!" };
+    for (qw/Chicken Salmon/) { dinner($_) }
+};
+
+sub dinner {
+    my $choice = shift;
+
+    div {
+        class is "item";
+        h2 { $choice }
+    }
+}
+---
 #title Template::Declare
 Neat tools for coding:
 ---
@@ -192,7 +223,7 @@
 # templates
 
 package main;
-Template::Declare->init(roots => [qw/Application::View Framework::View/]);
+Template::Declare->init(roots => [qw/Framework::View Application::View/]);
 ---
 #title More features
 Private templates
@@ -241,6 +272,8 @@
 ---
 Memory leaks
 ---
+Jifty halos
+---
 #title Template::Declare
 Pitfalls
 ---
@@ -440,7 +473,7 @@
 package MySite::View;
 
 template 'search' => sub {
-    h1 { "Yet another hello!" }
+    h1 { "No results, mwa ha ha." }
 };
 ---
 #mode perl
@@ -448,7 +481,7 @@
 
 sub search {
     # ...
-    h1 { "Yet another hello!" }
+    h1 { "No results, mwa ha ha." }
     # ...
 }
 ---
@@ -456,14 +489,14 @@
 package MySite::View;
 
 template 'search.html' => sub {
-    h1 { "Yet another hello!" }
+    h1 { "No results, mwa ha ha." }
 };
 ---
 #mode perl
 package MySite::View;
 
 sub search.html {
-    h1 { "Yet another hello!" }
+    h1 { "No results, mwa ha ha." }
 }
 ---
 'Illegal declaration of subroutine MySite::View::search'
@@ -473,7 +506,7 @@
 
 no strict 'refs';
 *{"search.html"} = sub {
-    h1 { "Yet another hello!" }
+    h1 { "No results, mwa ha ha." }
 };
 ---
 #mode perl
@@ -520,7 +553,7 @@
 Template::Declare::TagSet::RDF
 ---
 #mode perl
-package Template::Declare::TagSet::HTML::Circa::1995;
+package Template::Declare::TagSet::HTML::Circa::1997;
 use base 'Template::Declare::TagSet::HTML';
 
 sub get_tag_list {
@@ -529,4 +562,80 @@
     return [@sane_tags, qw{marquee blink bgsound}];
 }
 ---
-Conclusion forthcoming!
+#title Template::Declare
+Other templating systems
+---
+#title Comparisons
+CGI
+---
+#title Comparisons - CGI
+Grand-daddy of them all
+---
+#mode perl
+print dl(
+    map {
+        dt(escapeHTML($_)),
+        dd(escapeHTML($data->{$_}))
+    } keys %$data
+);
+---
+Expressions, but no statements
+---
+#title Comparisons
+HTML::Mason
+---
+#title Comparisons - HTML::Mason
+Mason is good!
+---
+We use it
+---
+(Dave Rolsky)++
+---
+#mode html
+<%args>
+$data => {}
+</%args>
+
+<dl>
+%   for my $key (keys %$data) {
+        <dt><% $key %></dt>
+        <dd><% $data->{$key} %></dt>
+%   }
+</dl>
+---
+But it's still HTML
+---
+#title Comparisons
+Template Toolkit
+---
+#title Comparisons - Template Toolkit
+It ain't Perl!
+----
+I like Perl
+---
+#mode html
+<dl>
+[% FOREACH datum in data %]
+    <dt>[% datum.key %]</dt>
+    <dd>[% datum.value %]</dd>
+[% END %]
+</dl>
+---
+#title Template::Declare
+Conclusion
+---
+#title Conclusion
+STOP WRITING HTML
+---
+#mode perl
+template 'display_hash' => sub {
+    my $data = shift;
+
+    dl {
+        for my $key (keys %$data) {
+            dt { $key }
+            dd { $data->{$key} }
+        }
+    }
+};
+


More information about the Jifty-commit mailing list