in reply to Template Question
The simplest way would be to just switch the variables from the $varname format to <TMPL_VAR NAME=VARNAME> and use HTML::Template (see the docs for more info).