I have a perl function which, amongst other things, needs to redirect
the request to another page.

It also needs to pass all the query parameters of the original request
(both GET and POST) to the redirected page, and also add one parameter
of it's own (an error message).

Sounds simple enough, but I'm having problems with the passing paramters
bit.

Here's what I have:

sub show_error {
        my ($r, $error) = @_;

        # $r is an Apache:Request object passed by the caller

        my $uri = URI->new($url);
        foreach my $p (@params) {
                $uri->query_form($p => $r->param($p));
        }
        $uri->query_form(error => $error);
        $r->internal_redirect($uri->canonical);
}

But this doesn't work. The '?error=' query string gets passed, but the
orginal request query strings don't.

What am I doing wrong? And is there an easier way?

Thanks,
Tom


Reply via email to