There are all kinds of things you CAN do in TT, but that doesn't mean you should do them.
I'm quite well aware of that, but thanks for reminding anyway ;)
What I want to do is really simple output processing (like substituting for spaces in menus). I think that's something I can safely do in a template -- if not, I'll be happy to hear why before I go too far in a wrong direction :)
I checked merlyn's examples. Here are the results:
Template:
--cut here--
[% MACRO tr_test BLOCK %]
join ':', @_;
[% END %]
[% PERL %]
$stash->set( 'tr_test_2', sub { join ':', @_ } );
[% END %]
1: [% tr_test( 'test', '1' ) %]
2: [% tr_test_2( 'test', '2' ) %]
--cut here--
And the result:
--cut here--
1:
join ':', @_;
2: test:2
--cut here--
So the latter does exactly what I need. Thanks for both answers.
-
marcink
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.