Rob Nagler wrote: > Perrin Harkins writes: > >>You can actually do that pretty comfortably with Template Toolkit. You >>could use a filter for example, which might look like this: >> >>[% FILTER font('my_first_name_font') %] >>... some text, possibly with other template directives in it... >>[% END %] > > > One of the reasons Perl is popular is its idioms. Having to say > something in three lines is not as idiomatic as one line. It takes a > lot of discipline to use it everywhere. In other words, I don't think > the above is more comfortable than: > > String(['User.first_name'], 'my_first_name_font');
The advantage is that my example can contain other templating code: [% FILTER font('basic_info_font') %] Hello [% User.first_name %]!<BR> [% IF User.accounts %] You have these accounts:<BR> [% FOREACH User.accounts %] [% name %]: [% balance %]<BR> [% END %] [% END %] [% END %] Unless I'm missing something about your example, the FILTER concept seems more powerful. It is perfectly possible to simply add a plugin to TT to make it look like yor example though: [% String(User.first_name, 'my_first_name_font') %] > Note also the accessor for User.first_name in Template Toolkit is > probably nontrivial. Assuming it's just $User->first_name() and you passed in $User as part of your data to the view, there's no additional work. - Perrin