I'm having a slight problem with CGI::App that I can't seem to figure out. I
have overloaded load_tmpl to use HTML::Template::Expr instead of the regular
module.
sub load_tmpl_expr {
my ($self, $ht_params, $tmpl_params, $tmpl_file) = @_;
my $template_obj = '';
use HTML::Template::Expr;
if (ref $tmpl_file eq 'SCALAR') {
$template_obj = HTML::Template::Expr->new_scalar_ref($tmpl_file,
%{$ht_params});
}
elsif (ref $tmpl_file eq 'GLOB') {
$template_obj = HTML::Template::Expr->new_filehandle($tmpl_file,
%{$ht_params} );
}
else {
$template_obj = HTML::Template::Expr->new_file($tmpl_file,
%{$ht_params} );
}
return $template_obj;
}
and also overloaded cgiapp_postrun to encapsulate the output of all the
runmodes in a main template.
sub cgiapp_postrun {
my $self = shift;
my $output_ref = shift;
my $masterTemplate = $self->load_tmpl('GMOP_master.html');
$masterTemplate->param('CONTENT', $$output_ref);
$masterTemplate->param('SECTIONNAME', $self->param('section_name'));
# Replace old output with new output
$$output_ref = $masterTemplate->output();
}
Hoever load_tmpl seems to have stopped working for the runmodes except for
cgiapp_postrun. In fact it seems like all the runmodes die without giving
any errors at all. They all just stop right before loading the template.
I've put in print STDERR statements before and after the load_tmpl and the
print statment before the load_tmpl always shows up in the logs but the one
after never does. So I'm guessing that the runmode is dying unexpectedly.
Can anyone give me any suggestions as to what I'm doing wrong or if anyone
has come across this problem before?
Thanks,
Jamie