[cgiapp] Custom template tags

Julio Fraire julio.fraire at gmail.com
Tue Oct 12 20:23:41 EDT 2010


Michael,

You are probably thinking of the filter option to the HTML::Template
constructor. From the docs:

"filter - this option allows you to specify a filter for your template
files. A filter is a subroutine that will be called after HTML::Template
reads your template file but before it starts parsing template tags. In the
most simple usage, you simply assign a code reference to the filter
parameter. This subroutine will recieve a single argument - a reference to a
string containing the template file text. Here is an example that accepts
templates with tags that look like "!!!ZAP_VAR FOO!!!" and transforms them
into HTML::Template tags"

And then the example is basically a regex within a subroutine that's applied
before parsing the template for tags.

Regards,

Julio Fraire


More information about the cgiapp mailing list