Bingo!
Of course one could think more about the API, but i love it already. It is really what i had in mind.
For maximum flexibility one could add shebang detection:
my $tpi = TPI->new( dsn => 'tpd:Mason:/my/files/' );
$tpi->register( 'TPD::HTML_Mason', shebang => '#!mason' );
$tpi->register( 'TPD::TT', shebang => '#!tt' );
$tpi->register( 'TPD::HTML_Template', shebang => '#!htmpl' );
$tpi->register( 'TPD::PETAL', shebang => '#!petal' );
$tpi->variables( author => 'a', title => 'b' );
print $tpi->interpolate( <<'END_HERE' );
#!mason
Welcome <% $author %>
END_HERE
print $tpi->interpolate( <<'END_HERE' );
#!htmpl
Welcome <TMPL_VAR author>
END_HERE
Of course the TPD driver could translate ie. looop variables n'stuff.
I am convinced that ~90% demand nothing more than the basic functionality from the templating engine. And so one could unify all the tons of api to just TPI.
I am convinced this would be fastly adopted/standard as DBI.
Anybody setting up a ml?
Murat
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.