I would indeed use WRAPPER here instead of rolling my own:

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 %]
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.

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)

In reply to Re: automatic Template component wrapper by jeffa
in thread automatic Template component wrapper by marvell

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.