Good localtime() to you,
So I am getting a little fancier with my CGI::Applications these days. . .
I'm using inheritance to cut down the amount of duplicate code and
maintenance hassles I created for myself. I'm having some issues extending
the functionality of cgiapp_postrun() however. Allow me to explain my
intent a bit:
All of my apps use the exact same logic to wrap a standard look and feel
around the output of a runmode:
sub cgiapp_postrun
{
my $self = shift;
my $html_ref = shift;
my %config = %{$self->param("config")};
# Create a new instance of the page template
my $tmpl_frame = $self->load_tmpl($config{TMPL_FRAME});
# Dereference the output data
my $html = $$html_ref;
# Wrap the standard look-and-feel around the output
$tmpl_frame->param(
TITLE => $self->param("title"),
FOCUS => $self->param("focus"),
MESSAGE => $self->param("message"),
CONTENT => $html,
UPDATED => $config{UPDATED},
);
# Generate the new page
$html = $tmpl_frame->output();
# Fill in the form with whatever the user has already selected
use HTML::FillInForm;
my $form = new HTML::FillInForm;
$html = $form->fill(scalarref => \$html,
fobject => $self->param("session"));
# Replace old page with the new one
$$html_ref = $html;
}
So I threw this code in my base object (let's call it My::App) and it works
great!
I have an instance now where an app derived from My::App wants to process
the output of one of it's runmodes before the base object processes it. The
code for this looks like:
sub cgiapp_postrun
{
my $self = shift;
my $html_ref = shift;
# Drop out if we are printing a tax statement
return if $self->get_current_runmode() eq "print";
# Dereference the output data
my $html = $$html_ref;
# Draw the tab page
my $tabs = $self->draw_tabs($html);
# Replace old page with the new one
$$html_ref = $tabs;
# Invoke our ancestor's functionality
$self->SUPER::cgiapp_postrun(\$tabs);
}
And for a reason I can't explain, it seems as if the output in the base
object is completely ignored. I know it's being called, because if I throw
a die() in there, the app does in fact die. But the output of the runmode
isn't displayed. What am I doing wrong? I've been staring at this a while
and I have the feeling something simple is glaring at me. I just can't see
it.
Thanks a bunch!
Jason
--------------------------------------------------
Jason A. Crome
Senior Software Engineer, DEVNET, Inc.
E-Mail: suppressed
http://www.devnetinc.com
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.