in reply to Re: HTML::Template Form Usage
in thread HTML::Template Form Usage

HTML::Template purists will hate that idea, and they should, because you'd be perverting a very powerful and beautiful tool, but if it's the best solution you have, then use it. Then again, I'd encourage you not to be afraid of having two similar loops here (using TMPL_IF to replace possible null fields with   might also help).

One little problem with the TMP_IF scenario is that, at least with HTML::Template version 2.4, a variable was classified as defined simply by it being passed to the template via the $template->param method. The value of the variable was not interpolated and this approach wouldn't work because although the variable is undefined, the act of simply passing it to the template would result in the variable being classified as 'defined' and able to be displayed.

The solution I found was to make use of the HTML::Template extension module HTML::Template::Expr which allows conditional expressions to also be incorporated into the template file and as such gives you greater control over variable "definition".

 

perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'