Your SlideShare is downloading. ×
0
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
MobaSiF::Template Introduction
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

MobaSiF::Template Introduction

3,182

Published on

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

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

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,182
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
12
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. MobaSiF::Template DeNA - Tadashi Matsuda - bobpp bobpp+yapc@bobpp.jp YAPC::Asia 2009 - 2009.09.10
  • 2. • • MobaSiF::Template / • • •
  • 3. • ( ) • bobpp ( ) • http://bobpp.jp/ •( ) • (http://mbok.jp)
  • 4. YAPC! • YAPC • •
  • 5. Check this! •Twitter: BoBpp •
  • 6. MobaSiF
  • 7. Moba* Simple Framework
  • 8. Moba* • • 2003 • •5 PV/day • and more...
  • 9. Moba* Simple Framework
  • 10. Mobile Simple Framework
  • 11. YAPC::Asia 2008
  • 12. MobaSiF::Template
  • 13. MTemplate • MobaSiF::Template • MobaSiF •
  • 14. MobaSiF::Template • (MobaSiF::*) • github • CPAN • •
  • 15. • • MobaSiF::Template • • MobaSiF::Template::Compiler •
  • 16. HTML Template (*.html)
  • 17. HTML Template (*.html) MobaSiF::Template::PreCompiler MobaSiF:::Template::Compiler precompile compile Include Template (*.txt/html)
  • 18. HTML Compiled Template Template (*.html) (*.bin) MobaSiF::Template::PreCompiler MobaSiF:::Template::Compiler precompile compile Include Template (*.txt/html)
  • 19. HTML Compiled Template Template (*.html) (*.bin) MobaSiF::Template::PreCompiler MobaSiF:::Template::Compiler MobaSiF::Template precompile compile insert / render Include Output Template (*.html) (*.txt/html)
  • 20. 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)
  • 21. • • • • • • URL Encode •
  • 22. $ cpan cpan> install MobaSiF::Template
  • 23. < : > <!-- Escape --> $=h:escape_string$ <!-- Escape (bypass) --> $=b:not_escape_data$ <!-- URL Encode --> $=e:url_encode_string$
  • 24. < : > $ if (val > 10) { $ val 10 $ } elsif (val > 5) { $ val 5 $ } else { $ val 5 $}$
  • 25. < : > $ loop (list) { $ $=h:id$ / $=h:key$ / $=h:value$ $}$
  • 26. < > use MobaSiF::Template::Compiler; MobaSiF::Template::Compiler::compile( “/path/to/template_file.html”, “/path/to/compiled_binary_file.bin” );
  • 27. < > 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);
  • 28. 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);
  • 29. 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);
  • 30. 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);
  • 31. Benchmark! <Rivals> • Template Toolkit • Tenjin • HTML::Template::Pro • MobaSiF::Template
  • 32. Benchmark • / • 10,000 qps
  • 33. Machine • MacBook • OS X 10.5 Leopard • perl v.5.8.9 • 2.4GHz Core2 Duo • 4GB Memory
  • 34. Result. Benchmark#1
  • 35. 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
  • 36. binary template / XS
  • 37. binary template • (option)... • • XS
  • 38. XS • mmap •
  • 39. NULL
  • 40. PLAIN REPLACE IF/ELSE LOOP / etc. NULL
  • 41. • • View(Template) =
  • 42. • Pre-Compiler • Mobile Pre-Compiler • compile files command • tests! •
  • 43. • •
  • 44. CPAN / github • http://search.cpan.org/~bobpp/MobaSiF- Template/ • http://github.com/bobpp/perl-MobaSiF- Template/

×