Subject: | cgiapp_postrun not executed |
My CGI::Application runmode subroutines return instances of
HTML::Tree... they do not return strings.
This plugin seems to expect runmodes to return strings. It tries to
render the results of my runmode subroutines without calling the
cgiapp_postrun method:
sub cgiapp_postrun {
my ($self, $html_tree) = @_;
$$html_tree = ref ${$html_tree} ? ${$html_tree}->as_HTML(undef, ' ') :
$$html_tree ;
}
I dont have time to patch this, because I dont know the internals of
cgiapp well enough and I am busy. But here is what I had to do in my sub
to get things to work as a workaround:
sub pricing {
my ($app, $err) = @_;
my ( $package, $filename, $line, $subroutine, $hasargs,
$wantarray, $evaltext, $is_require, $hints, $bitmask
)
= caller(1);
warn "Caller data ( $package, $filename, $line, $subroutine,
$hasargs,
$wantarray, $evaltext, $is_require, $hints, $bitmask )";
use Model::M;
use View::P;
my $alist = Model::M::all($app);
my $llist = Model::L::all($app);
my $view = View::P->new(err => $err, app => $app, agent_list =>
$agent_list, lead_type_list => $lead_type_list);
my $view_out = $view->render; # returns an HTML::Tree instance
return ($package =~ /ValidateRM/) ? $view_out->as_HTML : $view_out ;
}