http://www.perlmonks.org?node_id=479465


in reply to The Power of Objects

Actually, I've discovered my solution above is *wrong*...

The problem is it's entirely reasonable to call a template without calling param(), eg.
my $tmpl = HTML::Template->new( filename => 'template.html' ); $tmpl->output();
Furthermore, param() is called a lot of times internally, behaving differently based on parameter types passed, so it's not trivial to override it.

In the end, I settled on overriding output(), and calling param() from there, setting the variables I needed. I don't think this changes the main point of my post, but I suppose I should use an example that actually works :)