Let's use Xslate - Osdc.tw 2011

  • 1,393 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,393
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
5
Comments
0
Likes
2

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. Let's use Xslate Fuji, Goro (gfx) <gfuji@cpan.org>
  • 2. Hello, Taiwan!
    • I am:
      • Fuji, Goro
      • 3. a.k.a. gfx
      • 4. a Perl hacker
      • 5. from Shibuya.pm, Japan ☢
  • 6. What's Xslate?
    • Xslate is a template engine for Perl5, developed at 2010
    • 7. Available in Catalyst, Mojolicous
  • 8. There're many template engines in CPAN
  • 14. But good TE must be …
    • Safe (tolerant to XSS)
    • 15. Fast
    • 16. Easy to use
    • 17. Xslate is the best one in CPAN
  • 18. Safe
    • Automatic HTML escaping by default
    • 19. de-adulting? No! fail-safe
  • 20. Safe: Smart Escaping
  • 21. Performance
    • Slow softwares suck
    • 22. 100 times faster than Template-Toolkit 2!
  • 23. $ perl benchmark/x-rich-env.pl
  • 24. Easiness to use
    • Perl6-like syntax
    • 25. TT2-like syntax
    • 26. Readable error messages
    • 27. Please give a try :)
  • 28. Install $ curl -L cpanmin.us | perl – Text::Xslate or $ cpanm Text::Xslate
  • 29. Command Line Interface $ xslate -Dlang='<Xslate>' -e 'Hello, <: $lang :> world!' Hello, &lt;Xslate&gt; world! $ xslate -e '<: my $add = -> $x, $y { $x + $y }; $add(40, 2) :>' 42
  • 30. Try Xslate! #!perl -w use strict; use Text::Xslate; my $tx = Text::Xslate->new(); my $template = <<'TEMPLATE'; Hello, <: $lang :> world! TEMPLATE print $tx->render_string($template, { lang => 'Xslate', });
  • 31. See also http://xslate.org/ and/or perldoc Text::Xslate
  • 32. 終了 謝謝