.. and I know this is a no-no here - much less as the first thing I post on PM. :)

However, there is a twist to this one.

Prelude

You see, I have evaluated all templating modules I could find, and I have seen all manner of interesting, cool, plain or otherwise approaches, but none of them satisfies me. It is amazing that will so many packages for doing templates out there, they all seem to fall into either of two extremes, with noone ever having walked the middle road.

The plot

They are either pure interpolators or (more or less) fullblown interpreters. Pure interpolators are modules like CGI::FastTemplate which will intentionally do absolutely nothing other than substitute variable names for values. Interpreters are modules like HTML::Template, TemplateToolkit2, HTML::Mason, AxKit and You::Name::It which will let you create templates that look more like some code source than HTML.

Mounting tension

Now I have a problem with both. Interpolators lead to a proliferation of microscopic tiny snippet templatelets whenever you try to produce tables, esp if there are different types of rows of which one gets chosen depending on some of the variables, or tables are nested, or (the Camel help me) a mix of both. Interpreters do solve this problem - but intersparsed with commands in arbitrary places and using visually complex constructs for the simple task of variable interpolation, their templates become a chore to read, much less write, not to mention that beyond a certain degree of complexity and flexibility (such as may be tempting to use with TemplateToolkit2) they go way above webdesigners' heads, putting the programmer back in the position of layout maintainer.

Climax

So what I am almost about to write is something that lies inbetween: CGI::FastTemplate-like syntax for interpolation, and SSI-like syntax for higher level constructs. On CPAN, there is nothing that meets these criteria. The Big Question is - does anyone know of an already ongoing effort for this kind of module?

Aftermath

If not, then here's a sneak peek at my overall idea: there will only be a single highlevel construct, a loop command that doubles as a conditional construct. Nested data structure interpolation will be supported by a dot operator ( "$[foo.bar]" = $templatevars->{foo}->{bar} ), with variables usable as part of variable names ( "$[foo.$bar]" = $templatevars->{foo}->{$templatevars->{bar}} - needs some thought about how exactly to disambiguate "$[foo.$bar.$baz]"). Comments?


In reply to I am about to write my very own templating module.. by Aristotle

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.