MobaSiF::Template Introduction
Upcoming SlideShare
Loading in...5
×
 

MobaSiF::Template Introduction

on

  • 4,116 views

MobaSiF::Template introduction on YAPC::Asia 2009 at 2009.09.10

MobaSiF::Template introduction on YAPC::Asia 2009 at 2009.09.10

Statistics

Views

Total Views
4,116
Views on SlideShare
3,676
Embed Views
440

Actions

Likes
4
Downloads
12
Comments
0

5 Embeds 440

http://blog.as-roma.com 432
http://webcache.googleusercontent.com 3
http://74.125.153.132 2
http://www.slideshare.net 2
http://b.hatena.ne.jp 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

MobaSiF::Template Introduction MobaSiF::Template Introduction Presentation Transcript

  • MobaSiF::Template DeNA - Tadashi Matsuda - bobpp bobpp+yapc@bobpp.jp YAPC::Asia 2009 - 2009.09.10
  • • • MobaSiF::Template / • • •
  • • ( ) • bobpp ( ) • http://bobpp.jp/ •( ) • (http://mbok.jp)
  • YAPC! • YAPC • •
  • Check this! •Twitter: BoBpp •
  • MobaSiF
  • Moba* Simple Framework
  • Moba* • • 2003 • •5 PV/day • and more...
  • Moba* Simple Framework
  • Mobile Simple Framework
  • YAPC::Asia 2008
  • MobaSiF::Template
  • MTemplate • MobaSiF::Template • MobaSiF •
  • MobaSiF::Template • (MobaSiF::*) • github • CPAN • •
  • • • MobaSiF::Template • • MobaSiF::Template::Compiler •
  • HTML Template (*.html)
  • HTML Template (*.html) MobaSiF::Template::PreCompiler MobaSiF:::Template::Compiler precompile compile Include Template (*.txt/html)
  • HTML Compiled Template Template (*.html) (*.bin) MobaSiF::Template::PreCompiler MobaSiF:::Template::Compiler precompile compile Include Template (*.txt/html)
  • HTML Compiled Template Template (*.html) (*.bin) MobaSiF::Template::PreCompiler MobaSiF:::Template::Compiler MobaSiF::Template precompile compile insert / render Include Output Template (*.html) (*.txt/html)
  • HTML HTML Compiled HTML HTML Template Template Template Template Template (*.html) (*.html) (*.bin) (*.html) (*.html) MobaSiF::Template::PreCompiler MobaSiF:::Template::Compiler MobaSiF::Template precompile compile insert / render Include Output Template Compile Command (*.html) (*.txt/html)
  • • • • • • • URL Encode •
  • $ cpan cpan> install MobaSiF::Template
  • < : > <!-- Escape --> $=h:escape_string$ <!-- Escape (bypass) --> $=b:not_escape_data$ <!-- URL Encode --> $=e:url_encode_string$
  • < : > $ if (val > 10) { $ val 10 $ } elsif (val > 5) { $ val 5 $ } else { $ val 5 $}$
  • < : > $ loop (list) { $ $=h:id$ / $=h:key$ / $=h:value$ $}$
  • < > use MobaSiF::Template::Compiler; MobaSiF::Template::Compiler::compile( “/path/to/template_file.html”, “/path/to/compiled_binary_file.bin” );
  • < > use MobaSiF::Template; my $param = +{ hoge => 1, fuga => [ +{ id => 1, value => ‘A’ }, +{ id => 2, value => ‘B’ }, ] }; print MobaSiF::Template::insert( “/path/to/compiled_binary_file.bin”, $param);
  • use MobaSiF::Template; my $param = +{...}; $MobaSiF::Template::DEVELOP = 1; print MobaSiF::Template::render( “/path/to/template_file.html”, “/path/to/compiled_binary_file.bin”, $param);
  • use MobaSiF::Template; 0 my $param = +{...}; $MobaSiF::Template::DEVELOP = 1; print MobaSiF::Template::render( “/path/to/template_file.html”, “/path/to/compiled_binary_file.bin”, $param);
  • use MobaSiF::Template; 1 down 0 my $param = +{...}; $MobaSiF::Template::DEVELOP = 1; print MobaSiF::Template::render( “/path/to/template_file.html”, “/path/to/compiled_binary_file.bin”, $param);
  • Benchmark! <Rivals> • Template Toolkit • Tenjin • HTML::Template::Pro • MobaSiF::Template
  • Benchmark • / • 10,000 qps
  • Machine • MacBook • OS X 10.5 Leopard • perl v.5.8.9 • 2.4GHz Core2 Duo • 4GB Memory
  • Result. Benchmark#1
  • Result. Benchmark#1 0 5000.00 10000.00 15000.00 20000.00 Template Toolkit 585.8 Tenjin 2421.3 HTML::Template::Pro 6451.6 MobaSiF::Template 17543.9
  • binary template / XS
  • binary template • (option)... • • XS
  • XS • mmap •
  • NULL
  • PLAIN REPLACE IF/ELSE LOOP / etc. NULL
  • • • View(Template) =
  • • Pre-Compiler • Mobile Pre-Compiler • compile files command • tests! •
  • • •
  • CPAN / github • http://search.cpan.org/~bobpp/MobaSiF- Template/ • http://github.com/bobpp/perl-MobaSiF- Template/