perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <>
Subject Re: Newbie help with Apache2::Request configuration
Date Sun, 01 Jan 2006 21:01:39 GMT
> My apologies for being a dumbo, your forbearance is much appreciated!
no problem... Everybody has to start somewhere.

> You seem to recommend the APR:* interfaces, but then go on to show that 
> to use APR::Request::Param to handle uploads, we will have to code 
> wrapper code similar to that in Apache2::Upload each time, for ourselves?
I was really just trying to illustrate a use of it and show that the 
Apache2::* API's are wrappers or applications of the APR.  Thus, you can 
do anything with the APR::* methods you could with the Apache2:: ones.

> I also didn't understand the difference between the two cookie classes, 
> except that there is an implication that the APR::Request::Cookie 
> classes do not call freeze/thaw automatically? Does this mean that I 
> have to call encode/decode on values when I create or access 
> APR::Request::Cookie cookies?
One does encoding decoding for you aka ' ' => %20
You might not need this depending on what you put in your cookies.
APR's Cookies does call them, but there are not the same freeze thaw.
There implemented as:
sub freeze { };
sub thaw { shift->value }
[Thats from memory so don't quote me on it]

Whereas Apache2's Cookie are more complex.

> I can't even seem to get the APR::Request->new() to work. 
> [embarrassment!] Mmmm, maybe there isn't a new() method? Or maybe my 
> install is broken: Can't locate auto/APR/Request/
sub handler {

	my $r = shift;
	my $req = APR::Request->handle($r);

	return Apache2::Const::OK;

>   $req = APR::Request::Custom->handle($pool,
>                                       "foo=arg1&bar=arg2",
>                                       "cookie=apache",
>                                        $parser, 1e6, $bb);
Thats to create a custom request object given the query string.  You'll 
like not going to use that particular method.  It has other uses though.

>   $param = $req->param("foo");
>   $cookie = $req->jar("cookie");

> Any code samples would help me, though at this stage, it seems to me 
> that the Apache2::Cookie is much easier to understand, create and use.
Familiar API .. aka CGI::Cookie().  Whereare the APR::* mirror the 
Apache's APR API

> One other thing, none of the SEE ALSO links work :(
I'm working on that....

Code sample:

package TEST::APREQ;

use strict;
use warnings FATAL => ’all’;

use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile => qw(OK);
use APR::Request::Apache2 ();

sub handler {
	my $r = shift;
	my $req = APR::Request::Apache2->handle($r);

	my $p = $req->args(’p’);	

	$r->print("p: $p");

	return Apache2::Const::OK;

For cookies, see the FAQ I wrote on the mp site: (3rd one down)

"Love is not the one you can picture yourself marrying,
but the one you can't picture the rest of your life without."

"It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone..."

Philip M. Gollucci ( 301.254.5198
Consultant /
Senior Software Engineer - TicketMaster -

View raw message