Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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

by eserte (Deacon)
on Jan 06, 2008 at 22:29 UTC ( #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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://660705]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2018-06-20 05:00 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.