You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Patrick Galbraith <pa...@mysql.com> on 2006/10/26 22:50:21 UTC

$r->param - where did it go?

Hi all,

in  mod_perl 1.0, there was $r->param(), for getting the key/values of a 
posted form - what happened to this lovely method?

ApacheRequestRec doesn't have a param method that I can see. There has 
to be some nice way to get this info.

Thanks in advance.

Patrick


Re: $r->param - where did it go?

Posted by Jonathan Vanasco <ap...@2xlp.com>.
On Oct 26, 2006, at 6:02 PM, Patrick Galbraith wrote:

> Thanks much! I did find Apache2::Request. I'm really a bit lost  
> with all the changes in mod_perl2 and libapreq2. It seems, at least  
> to me, that version 1.0 of both seemed a bit more simple and  
> concise whereas now is a bit scattered as to what modules do what.  
> I don't understand why libapreq2 is separate from mod_perl. Before,  
> I could do:
>
> sub handler {
>  my $r = @_;
>  my $form = $r->param

hm.  i had no idea.  never used the 1.x branch

> Something as basic as obtaining the form parameters seem like  
> something that not require a separate module. I don't understand  
> why this was changed. If I was a newbie who had never done mod_perl  
> programming and had no dogmatic allegiance to perl, I'd be lost,  
> and probably end up coding in PHP.

libapreq is mostly an apache module that provides a c library, not a  
perl one.  it ships with / is popular for the Perl glue it provides.
i *believe* its being mostly split and migrated into apache core and  
mp2, but i could be wrong.  someone else here will chime in,

you don't need libapreq to get to the post data.  there are a ton of  
modules that do that in pure perl (like the cgi series, and others )

libapreq / Apache2::Request just does it fastest -- and handles it as  
$r->param

> I've had to really hunt around for information and hack around to  
> get things to work. It seems many linux distributions do a poor job  
> of packaging mod_perl/libapreq2 in such a way that it works out-of- 
> the-box.

i think it works out of the box on freebsd only ( thanks AGAIN to  
Philip )

if you use ubuntu, you can get it to work off the global (or whatever  
its called ) ports tree , just by switching sources for apt-get.

its a damn nightmare to do in suse/redhat/debian -- you're better off  
building from source on those platforms.

its poorly maintained in most ports trees though.  usually its only  
on the distros that a big site that runs it uses.  apache2/mod_perl2/ 
libapreq2 is an often forgotten system.
i think its half because everyone is hyped up over php/rails, and  
half that its geared for dedicated servers (not shared ones).  yet  
its still one of the fastest and most stable frameworks around (which  
is why smart people use it).


// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -



Re: $r->param - where did it go?

Posted by Patrick Galbraith <pa...@mysql.com>.
Jonathan Vanasco wrote:

>
> On Oct 26, 2006, at 4:50 PM, Patrick Galbraith wrote:
>
>> Hi all,
>>
>> in  mod_perl 1.0, there was $r->param(), for getting the key/values  
>> of a posted form - what happened to this lovely method?
>>
>> ApacheRequestRec doesn't have a param method that I can see. There  
>> has to be some nice way to get this info.
>
>
> its kind of weird how you asked the question though-- right mailing  
> list, wrong application.
>
> $r is Apache2::RequestRec , part of mod_perl
>
> you want an Apache2::Request object, part of libapreq
>
> sub handler {
>     my     $r= shift;
>     my     $apr= Apache2::Request->new( $r , DISABLE_UPLOADS=> 1 );
>     my     $fieldvalue= $apr->param('field');
> }
>
> $apr->param does get/post.  there are sep. functions for get & post  
> if you want one of them specifically too.

Jonathan,

Thanks much! I did find Apache2::Request. I'm really a bit lost with all 
the changes in mod_perl2 and libapreq2. It seems, at least to me, that 
version 1.0 of both seemed a bit more simple and concise whereas now is 
a bit scattered as to what modules do what. I don't understand why 
libapreq2 is separate from mod_perl. Before, I could do:

sub handler {
  my $r = @_;

  my $form = $r->param

.... and so on ...

}

Something as basic as obtaining the form parameters seem like something 
that not require a separate module. I don't understand why this was 
changed. If I was a newbie who had never done mod_perl programming and 
had no dogmatic allegiance to perl, I'd be lost, and probably end up 
coding in PHP.

I've had to really hunt around for information and hack around to get 
things to work. It seems many linux distributions do a poor job of 
packaging mod_perl/libapreq2 in such a way that it works out-of-the-box.

I've been doing mostly C/C++ for the past 3 years and maybe that's the 
problem!

regards,

Patrick

>
> // Jonathan Vanasco
>
> | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
> - - - - - - - - - - - - - - - -
> | FindMeOn.com - The cure for Multiple Web Personality Disorder
> | Web Identity Management and 3D Social Networking
> | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
> - - - - - - - - - - - - - - - -
> | RoadSound.com - Tools For Bands, Stuff For Fans
> | Collaborative Online Management And Syndication Tools
> | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
> - - - - - - - - - - - - - - - -
>
>


Re: $r->param - where did it go?

Posted by Jonathan Vanasco <ap...@2xlp.com>.
On Oct 26, 2006, at 4:50 PM, Patrick Galbraith wrote:

> Hi all,
>
> in  mod_perl 1.0, there was $r->param(), for getting the key/values  
> of a posted form - what happened to this lovely method?
>
> ApacheRequestRec doesn't have a param method that I can see. There  
> has to be some nice way to get this info.

its kind of weird how you asked the question though-- right mailing  
list, wrong application.

$r is Apache2::RequestRec , part of mod_perl

you want an Apache2::Request object, part of libapreq

sub handler {
	my 	$r= shift;
	my 	$apr= Apache2::Request->new( $r , DISABLE_UPLOADS=> 1 );
	my 	$fieldvalue= $apr->param('field');
}

$apr->param does get/post.  there are sep. functions for get & post  
if you want one of them specifically too.

// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -