>>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.
>
>     Mark

I tried this, but to no avail:

my $template;

sub setup {
   #do normal setup and run mode1
  $self->param('graphic','header.gif');
}

sub teardown {
   my $self = shift;
   my $graphic = $self->param('graphic'); # <-$graphic has a value here!
   $template->param(graphic => $graphic); # <-but doesn't get passed to
template here
}

sub mode1 {
   $template = $self->load_tmpl('users.tmpl');
   return $template->output;
}

Do I have it right?

Brad





---------------------------------------------------------------------
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