* [EMAIL PROTECTED] [2005-12-19T22:21:25] > Influenced by a long thread that I started over the weekend about the > number of run modes "allowed" in an application, I've been breaking my one > large app into several. I have a question about turning control back to > another module.
We do this a lot, with a method that, simplified to remove other weird things
we do, looks like this:
sub redispatch {
my ($self, $newclass) = @_;
eval "require $newclass";
die $@ if $@;
# by default, at the end of the runmode, the value is sent
# as the response. we want to return the value instead.
local $ENV{CGI_APP_RETURN_ONLY} = 1;
$self->register_wrapper; # set up TT2 wrapping, a la Mason autohandler
return $newclass->new(
PARAMS => { map { $_ => $self->param($_) } $self->param },
QUERY => $self->query,
)->run;
}
This works very nicely.
--
rjbs
pgpSMIdMqNb3Q.pgp
Description: PGP signature
