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: [EMAIL 
PROTECTED]
EOD
    }
    $req = APR::Request::Apache2->handle($req)
        unless $req->isa("APR::Request");

    my $jar = $req->jar or return;
    $jar->cookie_class(__PACKAGE__);
    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
APR::Request::Cookie

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


--
END
------------------------------------------------------------
    What doesn't kill us can only make us stronger.
                Nothing is impossible.
                                
Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
       http://www.liquidation.com
       http://www.uksurplus.com
       http://www.govliquidation.com
       http://www.gowholesale.com

Reply via email to