You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Konstantin Yotov <ko...@yahoo.com> on 2002/05/01 09:39:54 UTC

CGI::param,arg,content

Hello! :)

I read in the mod_perl, that arg is more fast than
CGI::param, but when I try to use it I can get form
date only when use method GET. I try this:
%param = $r->method eq 'post' ? $r->content :
$r->args;
But without a success. Please give me some advice.
Thank you.

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

Re: CGI::param,arg,content

Posted by "Doran L. Barton" <fo...@iodynamics.com>.
Not long ago, Konstantin Yotov proclaimed...
> I read in the mod_perl, that arg is more fast than
> CGI::param, but when I try to use it I can get form
> date only when use method GET. I try this:
> %param = $r->method eq 'post' ? $r->content :
> $r->args;
> But without a success. Please give me some advice.

The $r->args method only works for GET requests. You need to use
$r->content to grab the parameters passed in with the POST method.

The Eagle book has a good example of a catch-all:

	my %params;
	my @args = ($r->args, $r->content);
	while(my($name, $value) = splice @args,0,2) {
	  push @{$params{$name}}, $value;
        }

The result is a hash (%params) of lists which contains all the name-value 
pair data.

-=Fozz

-- 
Doran L. Barton <fo...@iodynamics.com> - Chief Super Hero - Iodynamics LLC
< http://www.iodynamics.com/ > - Linux solutions and dynamic websites
 "Have many accidents here."
    -- Seen in a Tokyo traffic handbook

Re: CGI::param,arg,content

Posted by Per Einar Ellefsen <pe...@skynet.be>.
At 09:39 01.05.2002, Konstantin Yotov wrote:
>Hello! :)
>
>I read in the mod_perl, that arg is more fast than
>CGI::param, but when I try to use it I can get form
>date only when use method GET. I try this:
>%param = $r->method eq 'post' ? $r->content :
>$r->args;
>But without a success. Please give me some advice.

That should be my %params = $r->method eq 'POST' ? $r->content : $r->args;
(note the upper case).

Anyway, you probably want to look into Apache::Request, which is a mod_perl 
replacement for CGI.pm (although without all the HTML generation features).


-- 
Per Einar Ellefsen
per.einar@skynet.be