go ahead... be a heretic | |
PerlMonks |
Template::Toolkit - uc() and lc(), other simple formatting mutators - see TT Filters!by jaa (Friar) |
on Apr 23, 2008 at 10:47 UTC ( [id://682357]=perlquestion: print w/replies, xml ) | Need Help?? |
jaa has asked for the wisdom of the Perl Monks concerning the following question:
Folks,
Blush for asking a newbie Template::Toolkit question! I am more looking for general pointers in the right direction, (I know there is always a pain barrier when getting my head around a new tool...) As an e.g. in my playing around I want to: But the only way I have found to do this is:
This is a trivial example - I can imagine that I will end up implement my own class with ALL my common view mutator - upper() lower() proper() escape() commify() etc Yes, I know about HTML.escape() and I am sure that there are date classes with formatting mutators... Is this what everyone else does? Is there a 'better way'? Actually I am hoping for a 'Doh!' when you point out that these are all built-ins in TT and that I have not found the right docs! I am reluctant to do this formatting in the Model components as I see it as part of rendering an HTML view (eg escape(). I also think it kind-of breaks the 'keep it easy for template tweakers' principle. Many thanks for your pearls! Jeff
Back to
Seekers of Perl Wisdom
|
|