package My::App; use base qw(CGI::Application); sub load_tmpl { my $self = shift; my $template = $self->SUPER::load_tmpl(@_); # add some global params here $template->param( ... ); return $template; } sub runmode { my $self = shift; my $template = $self->load_tmpl('filename.tmpl'); $template->param( ... ); return $template->output; }