in reply to Callbacks and templates.

You can also define callbacks using HTML::Template::Expr. Look:
my $tmpl = new HTML::Template::Expr filename => 'template.html', functions => { site_name => \&site_name, };
And in template you can write:
<TMPL_VAR EXPR="site_name()">