The Most Common Template Toolkit Mistake

  • 825 views
Uploaded on

This was a lightning talk presented at YAPC::NA 2011.

This was a lightning talk presented at YAPC::NA 2011.

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

Views

Total Views
825
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
3
Comments
0
Likes
0

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. The Most Common Template Toolkit Mistake Perrin Harkins We Also Walk Dogs
  • 2. Yesterday, Uri did a lighting talkTemplate::Simple has a benchmark scriptApparently it is faster and lighter than Template Toolkit
  • 3. Years ago, I did a talk on templatingsystemshttp://tmpl.notlong.comSince then, many people have told me about their newmodule
  • 4. People often break TemplateToolkits cachemy $tt = Template->new({ INCLUDE_PATH => /usr/local/templates}) || die "$Template::ERRORn";$tt>process( letters/overdrawn, $vars) || die $tt->error(), "n"; Dont throw away your Template instance! The cache is in there!
  • 5. Uris benchmark didnt do thatIt did something else: template in a scalar refIs that a bug?How can you fix it?Subclass Template::Provider, e.g. Template::Provider::MD5Temp file
  • 6. Template::Simple is still much fasterBut Template Toolkit isnt as slow as it looked.More than 300% faster than before.
  • 7. Why I like slow and heavy templatesSeparates presentation code from model and controller ● Keeps display things that wouldnt make sense in a cron job in your output layer ● Format dates and numbers ● Put things in multiple columns ● Display objects ● Maybe sort things?Mason, etc. are fine for this, not just TT