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 "Gokul P. Nair" <gp...@yahoo.com> on 2005/06/23 22:29:59 UTC

APR::* confusion in setting and retrieving cookies through libapreq2

Hello,

I'm trying two simple functions i.e. to set a cookie
and retrieve it. I'm using Apache2, mod_perl2 &
libapreq2-2.05 to do this. 

I read in the libapreq2 mail archives that using
APR::* is recommended over the Apache2::Cookie modules
and that there was debate over dumping the Apache2::*
modules but were left behind only for backward
compatibilities. Please check this thread:
http://marc.theaimsgroup.com/?t=111695063000003&r=1&w=2

So after reading the above thread and this one:
http://marc.theaimsgroup.com/?t=111694486900009&r=1&w=2

i'm in total confusion as to which is the right way to
go about accomplishing 2 seemingly simple tasks of
setting and retrieving cookies. I've read the
documentation for APR::Request::Cookie and i'm unable
to figure out how to send the cookie after creating
one. 

So, i've basically got this:

  use APR::Request::Cookie;
  
  my $cookie = APR::Request::Cookie->new($req, 
                name => "foo",
                value => "bar",                       
                                                      
                   
                domain => "whatever.com");

Now from here how do i bake the cookie or send it?
using $r->headers_out... ?

Also $req needs to be an object of type APR::Pool and
in the documentation for APR::Pool it is suggested
that it is good to use a request pool for these short
scoped requests. So would $req be created like this ?
$req = APR::Request::Apache2->handle($r)

It's quite obvious that i'm pretty confused at this
point with the new naming convention, so any help or
advice would be greatly appreciated.

Another question i have is this - I went through the
code for APR::Request::Cookie and I don't see method
definitions for most of the methods/subs listed in the
documentation, even in the base class i.e.
APR::Request. Are these methods implemented as
functions in C code that is then dynamically linked
and bootstrapped through the dynaLoader module?

Thanks,

Gokul P. Nair




		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com