Re: Question about Apache::Request and query strings

2003-07-14 Thread Stas Bekman
Tom Gazzini wrote:
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?
This example may help:
http://perl.apache.org/docs/1.0/guide/snippets.html#Reusing_Data_from_POST_request
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Question about Apache::Request and query strings

2003-06-27 Thread Swen Schillig

Tom

Where's @params coming from ?
Are you sure it's not empty ?


Swen



|-+
| |   Tom Gazzini|
| |   [EMAIL PROTECTED]|
| |   uk  |
| ||
| |   06/26/2003 04:42 |
| |   PM   |
| ||
|-+
  
--|
  |
  |
  |   To:   [EMAIL PROTECTED]
|
  |   cc:  
  |
  |   Subject:  Question about Apache::Request and query strings   
  |
  |
  |
  |
  |
  
--|



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