in reply to automatic Template component wrapper
I would indeed use WRAPPER here instead of rolling my own:
Using WRAPPER may be a bit more wordy than your header/footer solution, but it also has the added advatange of escaping any content contained in the WRAPPER for you.use Template; my $tt = Template->new; $tt->process(\*DATA, { comp => { name => 'foo', modtime => scalar(localtime) } }) || die $tt->error(); __DATA__ [% WRAPPER wrap comp = comp %] content goes here [% END %] [% BLOCK wrap %] <!-- BEGIN [% comp.name %] ([% comp.modtime %]) --> [% content %] <!-- END [% comp.name %] --> [% END %]
Not that this information solves your problem, but HTML::Mason has an autohandler, which not only acts as a WRAPPER, but also gives you finer control at the directory lever: all Mason components in a directory are handled by the autohandler -- and can be used to wrap all components automagically. I haven't found how to do this in TT yet, but i would be surprised if you can't. Hopefully another monk will know the answer, have you tried the TT mailing list?
Update: Herkum++ (that's what i get for getting pulled away from the problem and not refreshing to see if anyone had answered the question :P)
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: automatic Template component wrapper
by marvell (Pilgrim) on Mar 10, 2006 at 20:03 UTC |