metaperl has asked for the wisdom of the Perl Monks concerning the following question:

Is a region filter already available for TT?

What I mean by region filter is something that takes a series of input lines but only returns those within a certain region.

If no such filter is written, I propose one with the following API:

region($a, $b) where $a and $b specify the start and end of the lines to return

It looks like TT filters can only accept numbers and strings, so a string argument would be turned into a regexp.

example: Include a .pm file, but ignore the trailing pod:

[% INCLUDE source_code.pm | region('^package', '^1;') | indent %]




The mantra of every experienced web application developer is the same: thou shalt separate business logic from display. Ironically, almost all template engines allow violation of this separation principle, which is the very impetus for HTML template engine development.

-- Terence Parr, "Enforcing Strict Model View Separation in Template Engines"