perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <>
Subject Re: Apache2::Cookie bug, or just my misinterpretation?
Date Fri, 23 Sep 2005 07:22:57 GMT
Foo Ji-Haw wrote:
> I get the request cookie names like this:
> my $jar = Apache2::Cookie::Jar->new($r);
> my @keys = $jar->cookies();
sub fetch {
     my $class = shift;
     my $req = shift;
     unless (defined $req) {
         my $usage = 'Usage: Apache2::Cookie->fetch($r): missing argument $r';
         $req = eval {Apache2::RequestUtil->request} or die <<EOD;
$usage: attempt to fetch global Apache2::RequestUtil->request failed: $@.
     $req = APR::Request::Apache2->handle($req)
         unless $req->isa("APR::Request");

     my $jar = $req->jar or return;
     return $jar->get(shift) if @_;
     return wantarray ? %$jar : $jar;

The reason why is that you do 'wantarray'

You want to instead write:

my $keys_hashref = $jar->cookies();

Also, we don't recommend the Apache2::* interface after/as of 2.05-dev, but 
instead the APR equivalents.

Have a look at

You'll notice, its the Apache2::Cookie::fetch() is a wrapper around the APR one 

     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
Philip M. Gollucci ( 301.254.5198
Consultant /
Senior Developer / Liquidity Services, Inc.

View raw message