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

Re: [cgiapp] CAP::Forward and CA::Dispatch



Michael Lackhoff wrote:
> Hi all,
> 
> I am still in the starting phase of a new application that might grow to quite a few runmodes.
> So I decided to break my App into smaller parts and connect them with the help of 
> CA::Dispatch.
> 
> This works quite nicely with (until now) only one problem left: At the end of a few runmodes I 
> don't want to create runmode-specific output but forward to another runmode instead. Now, 
> the target of this forwarding is in another (sub-)App and I don't know how to forward across 
> App boundaries.
> 
> Well, I could output a minimal response with a redirect header but that would make the 
> forward somewhat external and would make the whole thing even slower because then the 
> click on 'submit' would cause two complete request/response cycles with Application 
> initialisation and everything until the user gets some response.

Well, it depends. If you need 2 complete cycles (setup, init, prerun,
postrun, etc) then using an external redirect isn't a bad option.

> So, is it somehow possible to use CAP::Forward to forward across App boundaries?
> Or should I use multiple inheritance to also have the runmodes of the target App in my 
> submitted App? Any other ideas?

I see a couple of options that might work depending on what the other
run mode does:

1) You could call the other method in the other class as if it were a
method on the current object.

  return Other::App::run_mode($self);

This has problems if the other run mode uses methods in the Other::App
class.

2) You could create a new instance of the other application and run the
other mode.

  my $other_app = Other::App->new( QUERY => $self->query );
  return $other_app->run_mode();

HTH

-- 
Michael Peters
Developer
Plus Three, LP


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