SlideShare uma empresa Scribd logo
1 de 53
テンプレートエンジンの移行 Changing Template Engine YAPC::Asia 2010 Tokyo Takatsugu Shigeta
@comewalk #sixapartkk #typepad
Q. Have you used any template engine?
Q. Which engine?
HTML::Template Template  Text::MicroTemplate Tenjin MENTA::Template Mojo::Template MTML Text::ClearSilver Text::Xslate
Migrating from HTML::Template to Template Toolkit
HTML::Template
<TMPL_VAR NAME=foo> TMPL_VAR, TMPL_IF, TMPL_UNLESS, TMPL_ELSE, TMPL_LOOP, TMPL_INCLUDE
  ,[object Object],[object Object],[object Object],[object Object],[object Object]
  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Template Toolkit
[% foo %] GET, IF, UNLESS, ELSE, FOR, INCLUDE (and others )
  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
  ,[object Object],[object Object],[object Object],[object Object],[object Object]
History
 
Motivation
* borrow their templates * unnecessary code on handler
borrow their templates
unnecessary code on handler ,[object Object],[object Object],[object Object],[object Object],[object Object]
unnecessary code on handler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
schedule
This graph is rough estimates :)
operations
run convert script
TMPL_VAR -> [% foo %] TMPL_IF -> [% IF %] TMPL_UNLESS -> [% UNLESS %] TMPL_ELSE ->[%  ELSE %] TMPL_LOOP -> [% FOR %] TMPL_INCLUDE -> [% INCLUDE%] MT_TRANS ->  [% |loc %]foo[% END %]
  ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object]
Tips
* Don't use reserved keywords * Don't use camel case variable name * Don't use underscore at first letter like _foo * MT_TRANS multi params
Don't use reserved keywords ,[object Object],[object Object]
Don't use reserved keywords ,[object Object],[object Object],[object Object]
Don't use camel case variable name ,[object Object],[object Object],[object Object]
Don't use camel case variable name ,[object Object],[object Object],[object Object],[object Object]
Don't use camel case variable name ,[object Object],[object Object],[object Object],[object Object]
Don't use underscore at first letter like _foo ,[object Object],[object Object]
MT_TRANS multi params   ,[object Object]
MT_TRANS multi params   ,[object Object]
sequence
 
TypePad::View::TT A wrapper class for TT which  bridges the gap between HTML::Template and Template Toolkit
  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
  ,[object Object],[object Object],[object Object],[object Object],[object Object]
  ,[object Object],[object Object],[object Object],[object Object],[object Object]
  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
sequence [after]
 
Benchmark
compare processing speed Template:           0.0173818 HTML::Template: 0.0157874 using Time::HiRes CentOS 4.6 (64bit), Perl v5.8.9, $Template::VERSION 2.15 $HTML::Template::VERSION 2.8
in near future, Text::Xslate
  ,[object Object],[object Object]
Questions?
[object Object]

Mais conteúdo relacionado

Mais procurados

Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching ResurrectedBen Scofield
 
Php Basic Security
Php Basic SecurityPhp Basic Security
Php Basic Securitymussawir20
 
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)Michael Wales
 
Apache Camel - WJax 2008
Apache Camel - WJax 2008Apache Camel - WJax 2008
Apache Camel - WJax 2008inovex GmbH
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplicationolegmmiller
 
Advanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIsAdvanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIsandrewnacin
 
Haml & Sass presentation
Haml & Sass presentationHaml & Sass presentation
Haml & Sass presentationbryanbibat
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniternicdev
 
[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet Viking[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet VikingAndrew Collier
 
Meetup django common_problems(1)
Meetup django common_problems(1)Meetup django common_problems(1)
Meetup django common_problems(1)Eric Satterwhite
 
Building Secure Twitter Apps
Building Secure Twitter AppsBuilding Secure Twitter Apps
Building Secure Twitter AppsDamon Cortesi
 
Introduction to HAML
Introduction to HAMLIntroduction to HAML
Introduction to HAMLJon Dean
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous MerbMatt Todd
 
Preparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for TranslationPreparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for TranslationBrian Hogg
 
Introduction To Lamp
Introduction To LampIntroduction To Lamp
Introduction To LampAmzad Hossain
 

Mais procurados (20)

Page Caching Resurrected
Page Caching ResurrectedPage Caching Resurrected
Page Caching Resurrected
 
Php Basic Security
Php Basic SecurityPhp Basic Security
Php Basic Security
 
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
Introduction to CodeIgniter (RefreshAugusta, 20 May 2009)
 
Apache Camel - WJax 2008
Apache Camel - WJax 2008Apache Camel - WJax 2008
Apache Camel - WJax 2008
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
Django
DjangoDjango
Django
 
symfony & jQuery (phpDay)
symfony & jQuery (phpDay)symfony & jQuery (phpDay)
symfony & jQuery (phpDay)
 
Advanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIsAdvanced and Hidden WordPress APIs
Advanced and Hidden WordPress APIs
 
Haml & Sass presentation
Haml & Sass presentationHaml & Sass presentation
Haml & Sass presentation
 
HTML 5 & CSS 3
HTML 5 & CSS 3HTML 5 & CSS 3
HTML 5 & CSS 3
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
 
[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet Viking[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet Viking
 
Meetup django common_problems(1)
Meetup django common_problems(1)Meetup django common_problems(1)
Meetup django common_problems(1)
 
Fast by Default
Fast by DefaultFast by Default
Fast by Default
 
Building Secure Twitter Apps
Building Secure Twitter AppsBuilding Secure Twitter Apps
Building Secure Twitter Apps
 
Introduction to HAML
Introduction to HAMLIntroduction to HAML
Introduction to HAML
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous Merb
 
Preparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for TranslationPreparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for Translation
 
Seasion5
Seasion5Seasion5
Seasion5
 
Introduction To Lamp
Introduction To LampIntroduction To Lamp
Introduction To Lamp
 

Destaque

GEOMETRY_ARHIMED
GEOMETRY_ARHIMEDGEOMETRY_ARHIMED
GEOMETRY_ARHIMEDviktoriya71
 
Evolution - Η Εξέλιξη της Ζωής
Evolution - Η Εξέλιξη της ΖωήςEvolution - Η Εξέλιξη της Ζωής
Evolution - Η Εξέλιξη της Ζωήςneutrinoteam
 
Oni nushdautsa v zashite
Oni nushdautsa v zashiteOni nushdautsa v zashite
Oni nushdautsa v zashiteviktoriya71
 
Durmak Yok Yolsuzluga Devam
Durmak Yok Yolsuzluga DevamDurmak Yok Yolsuzluga Devam
Durmak Yok Yolsuzluga Devammillitrk
 
TANET - Khai thue GTGT - 07.2010
TANET -  Khai thue GTGT -  07.2010TANET -  Khai thue GTGT -  07.2010
TANET - Khai thue GTGT - 07.2010Pham Ngoc Quang
 
Rio Omo Hans Sylvester
Rio Omo Hans SylvesterRio Omo Hans Sylvester
Rio Omo Hans Sylvestermariorui
 
#cetis12 badge session summary
#cetis12 badge session summary#cetis12 badge session summary
#cetis12 badge session summarySimon Grant
 
Podcasting intro 23feb11
Podcasting intro 23feb11Podcasting intro 23feb11
Podcasting intro 23feb11burkso2
 
Platfrom for community-based solutions
Platfrom for community-based solutionsPlatfrom for community-based solutions
Platfrom for community-based solutionsLatte Media
 
太平天國專題報告 – Week 1 version 1001
太平天國專題報告 – Week 1 version 1001太平天國專題報告 – Week 1 version 1001
太平天國專題報告 – Week 1 version 1001Yi-Chi Tang
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moondavejohnson
 
Adam & Jamie Videos on the 'Net
Adam & Jamie Videos on the 'NetAdam & Jamie Videos on the 'Net
Adam & Jamie Videos on the 'NetKen Kaplan
 

Destaque (20)

GEOMETRY_ARHIMED
GEOMETRY_ARHIMEDGEOMETRY_ARHIMED
GEOMETRY_ARHIMED
 
Evolution - Η Εξέλιξη της Ζωής
Evolution - Η Εξέλιξη της ΖωήςEvolution - Η Εξέλιξη της Ζωής
Evolution - Η Εξέλιξη της Ζωής
 
The Sunset
The SunsetThe Sunset
The Sunset
 
Libertad de expresión
Libertad de expresiónLibertad de expresión
Libertad de expresión
 
Oni nushdautsa v zashite
Oni nushdautsa v zashiteOni nushdautsa v zashite
Oni nushdautsa v zashite
 
Durmak Yok Yolsuzluga Devam
Durmak Yok Yolsuzluga DevamDurmak Yok Yolsuzluga Devam
Durmak Yok Yolsuzluga Devam
 
TANET - Khai thue GTGT - 07.2010
TANET -  Khai thue GTGT -  07.2010TANET -  Khai thue GTGT -  07.2010
TANET - Khai thue GTGT - 07.2010
 
Rio Omo Hans Sylvester
Rio Omo Hans SylvesterRio Omo Hans Sylvester
Rio Omo Hans Sylvester
 
A/B Testing 101
A/B Testing 101A/B Testing 101
A/B Testing 101
 
#cetis12 badge session summary
#cetis12 badge session summary#cetis12 badge session summary
#cetis12 badge session summary
 
De paso por Astorga
De paso por AstorgaDe paso por Astorga
De paso por Astorga
 
food
foodfood
food
 
Folleto de 1953
Folleto de 1953Folleto de 1953
Folleto de 1953
 
Hui
HuiHui
Hui
 
Podcasting intro 23feb11
Podcasting intro 23feb11Podcasting intro 23feb11
Podcasting intro 23feb11
 
Platfrom for community-based solutions
Platfrom for community-based solutionsPlatfrom for community-based solutions
Platfrom for community-based solutions
 
太平天國專題報告 – Week 1 version 1001
太平天國專題報告 – Week 1 version 1001太平天國專題報告 – Week 1 version 1001
太平天國專題報告 – Week 1 version 1001
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moon
 
Adam & Jamie Videos on the 'Net
Adam & Jamie Videos on the 'NetAdam & Jamie Videos on the 'Net
Adam & Jamie Videos on the 'Net
 
Maximize PPC Campaigns
Maximize PPC CampaignsMaximize PPC Campaigns
Maximize PPC Campaigns
 

Semelhante a Changing Template Engine

Php Crash Course
Php Crash CoursePhp Crash Course
Php Crash Coursemussawir20
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On RailsWen-Tien Chang
 
ImplementingChangeTrackingAndFlagging
ImplementingChangeTrackingAndFlaggingImplementingChangeTrackingAndFlagging
ImplementingChangeTrackingAndFlaggingSuite Solutions
 
Template Toolkit
Template ToolkitTemplate Toolkit
Template Toolkitdwm042
 
XML processing with perl
XML processing with perlXML processing with perl
XML processing with perlJoe Jiang
 
KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7phuphax
 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop APIChris Jean
 
Forum Presentation
Forum PresentationForum Presentation
Forum PresentationAngus Pratt
 
Drupal 7 Theming - what's new
Drupal 7 Theming - what's newDrupal 7 Theming - what's new
Drupal 7 Theming - what's newMarek Sotak
 
Struts2
Struts2Struts2
Struts2yuvalb
 
Flex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 FinalFlex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 Finalematrix
 
Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 1 V1.0Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 1 V1.0Cathie101
 

Semelhante a Changing Template Engine (20)

Php Crash Course
Php Crash CoursePhp Crash Course
Php Crash Course
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
 
JSP Custom Tags
JSP Custom TagsJSP Custom Tags
JSP Custom Tags
 
Control Structures In Php 2
Control Structures In Php 2Control Structures In Php 2
Control Structures In Php 2
 
ImplementingChangeTrackingAndFlagging
ImplementingChangeTrackingAndFlaggingImplementingChangeTrackingAndFlagging
ImplementingChangeTrackingAndFlagging
 
Template Toolkit
Template ToolkitTemplate Toolkit
Template Toolkit
 
XML processing with perl
XML processing with perlXML processing with perl
XML processing with perl
 
KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7
 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop API
 
Lecture4
Lecture4Lecture4
Lecture4
 
Forum Presentation
Forum PresentationForum Presentation
Forum Presentation
 
Drupal 7 Theming - what's new
Drupal 7 Theming - what's newDrupal 7 Theming - what's new
Drupal 7 Theming - what's new
 
Struts2
Struts2Struts2
Struts2
 
Flex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 FinalFlex For Flash Developers Ff 2006 Final
Flex For Flash Developers Ff 2006 Final
 
Combres
CombresCombres
Combres
 
John Rowley Notes
John Rowley NotesJohn Rowley Notes
John Rowley Notes
 
Ajax ons2
Ajax ons2Ajax ons2
Ajax ons2
 
Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 1 V1.0Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 1 V1.0
 
PHP MySQL
PHP MySQLPHP MySQL
PHP MySQL
 
JavaScript
JavaScriptJavaScript
JavaScript
 

Changing Template Engine