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:[% uc(myvar) %]
[% use String %] [% String.new(myvar).upper() %]
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
In reply to Template::Toolkit - uc() and lc(), other simple formatting mutators - see TT Filters! by jaa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |