Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: The hidden charm of Template::Toolkit (and templates generally)

by eserte (Deacon)
on Jan 06, 2008 at 22:29 UTC ( [id://660705]=note: print w/replies, xml ) Need Help??


in reply to The hidden charm of Template::Toolkit (and templates generally)

My rule of thumb is: if you need to generate text, then use a templating language if the dynamic part is much smaller than the already present static part of the text. I use Template-Toolkit for a lot of text generating, not necessarily HTML. Often it's just existing Makefiles or mapserver files or crontabs or some configuration files, which just need minor tweaks when running in different environments. So I can leave the files nearly as is, put some templating directives in it, and do not need to wrap it in a perl script.

Using a templating system is not necessary for the separation of concerns (layout vs. logic). If you're fine with generating html by perl code, and you really don't need any HTML coders to create the html, then do it so! But do it in a different function or module than the code doing the logic. This is enough to separate logic and layout.

  • Comment on Re: The hidden charm of Template::Toolkit (and templates generally)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://660705]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-19 19:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found