On 2005-12-27, Brad Cathey <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> Still trying to learn all the in's and out's of C::A. I'm curious about
> handling situations where I have common operations that must be applied to
> all modes upon exiting. Example:
>
> I load a unique .tmpl files and assign values to parameters in run modes.
> But before outputing, I want to assign some values common to all of .tmpls.
> cgiapp_postrun doesn't always work because it runs after each mode, and I
> only want it to run after all modes are finished (forwarding). I tried it
> teardown, but I lose the $common values somewhere before I get there.

Save $common:

  $self->param('common',$common);

Get $common in teardown():

  my $common = $self->param('common');


> I wish there was something like "cgiapp_lastrun" that would come only after
> the last mode for the instance was run, and before teardown.

It seems like the desire for this arises because although the teardown
is present at the place in flow you want, it's not doing what you want.
I think using param() can solve that. 


> sub teardown {
>    $template->param(graphic => $common->{'header_graphic'});
> }

This code isn't clear. It certainly wouldn't past "use strict".  It
appears $template and $common are at least package scope variables. 

Passing data through param() is the recommended alternative if a smaller
scope doesn't cut it for you.


    Mark


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to