Wouldn't it be great if everyone was writing docs like you do? :)
I checked it out - it seems quite interesting. Will give it more thougth in the morning
(it's 3AM ...).
Indeed, there are a number of solutions that can be implemented.  HTML::Template::Expr with a function callback is probably the easiest solution.

Another possiblility is to use the modified H::T that I use (available at  http://members.optusnet.com.au/~mathew) to create your own TMPL_xxx syntax.