On 2005-12-20, Ricardo SIGNES <[EMAIL PROTECTED]> wrote:
>
> We do this a lot, with a method that, simplified to remove other weird thin=
> gs
> we do, looks like this:
>
> sub redispatch {
> my ($self, $newclass) =3D @_;
> 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} =3D 1;
>
> $self->register_wrapper; # set up TT2 wrapping, a la Mason autohandler
>
> return $newclass->new(
> PARAMS =3D> { map { $_ =3D> $self->param($_) } $self->param },
> QUERY =3D> $self->query,
> )->run;
> }
>
> This works very nicely.
Interesting. This looks sort of like the sub_request that Catalyst has:
http://search.cpan.org/perldoc?Catalyst::Plugin::SubRequest
Why not use an external redirect, giving the resulting page a bookmarkable URL?
(It realize it takes a little more time and resources for an external
redirect because it's a roundtrip to the browser and back.)
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]