[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cgiapp] post_run hook?


I have another application for post_run() illustrated by the following.
Currently, to insert a body into a top-level HTML template, I use a code
like this:

sub my_runmode {
	...
	my $body_tmpl = $self->load_tmpl('my_runmode.tmpl');
	$body_tmpl->param(...);

	my $main_tmpl = $self->load_tmpl('main.tmpl');
	$main_tmpl->param( body => $body_tmpl->output );
	return $main_tmpl->output;
}

With post_run(), I could reduce this code to:

sub my_runmode {
	...
	my $body_tmpl = $self->load_tmpl('my_runmode.tmpl');
	$body_tmpl->param(...);
	return $body_tmpl->output;
}

and have post_run() to insert the body into the main template. Savings are
2 lines per run mode. Not that I cannot live without post_run(), but it
would be nice to have.  I just like neat code structure (that is why I use
CGI::Application in the first place).

Sincerely,

Arkady.

On Fri, 2 May 2003, Jesse Erlbaum wrote:

> Hi Adam --
>
> > As this will be the ideal thing to superclass for closing DB handles,
> > created in cgi_prerun.
>
> You could also do this via teardown().
>
> -Jesse-
>
>
>
> ---------------------------------------------------------------------
> Web Archive:  http://www.mail-archive.com/suppressed/
> To unsubscribe, e-mail: suppressed
> For additional commands, e-mail: suppressed
>
>


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
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.