Skip to content Skip to sidebar Skip to footer

Can The Perl Module Html::template Use Other Syntaxes Besides ?

I'm trying to make use of the Perl module HTML::Template and according to the docs it says you can use HTML comments instead of greater-than/less-thans around its markup but it is

Solution 1:

The only 2 methods I've found thus far are the following:

1 - HTML::Template has a switch called vanguard_compatibility_mode...from the perldocs

vanguard_compatibility_mode - if set to 1 the module will expect to see s that look like %NAME% in addition to the standard syntax. Also sets die_on_bad_params => 0. If you're not at Vanguard Media trying to use an old format template don't worry about this one. Defaults to 0.

2 - HTML::Template also supports embedding the template tags in comment blocks so that your code is HTML compliant, like so: <!-- TMPL_NAME NAME=FNAME -->

Again from the perldocs:

If you're a fanatic about valid HTML and would like your templates to conform to valid HTML syntax, you may optionally type template tags in the form of HTML comments. This may be of use to HTML authors who would like to validate their templates' HTML syntax prior to HTML::Template processing, or who use DTD-savvy editing tools.

<!-- TMPL_VAR NAME=PARAM1 -->

This 2nd option didn't work originally for me until I set the die_on_bad_params => 0 for the constructor.

Solution 2:

I don't see a paramater named "fname" anywhere in your code, so I don't understand the error message. Maybe the code you posted is not the complete code?

Regarding die_on_bad_params: Yes, setting it to 0 is the way to solve this, and I personally always set it to 0 and have never understood why one would need this option anyway. In my HTML::Template::Compiled (similar alternative to HTML::Template) module I have never implemented it.

Post a Comment for "Can The Perl Module Html::template Use Other Syntaxes Besides ?"