httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject Re: Apache::Cookie problem report (2.03_04-dev)
Date Sat, 19 Jun 2004 14:24:06 GMT
Joe Schaefer <joe+gmane@sunstarsys.com> writes:

[...]

> Random guess: it depends on how you're handler is invoking 
> 
>   Apache::Cookie->fetch # apreq2 needs $r here
> 
> In apreq2 you *must* pass the Apache::RequestRec $r; in apreq1 you do not.
> This should already be in the new Apache::Cookie documentation for
> fetch(), but we can certainly do a better job with the error message.

This version of fetch() will do its best to be backwards-compatible
via Apache->request, so be sure to look at the following url for its
requirements

  http://perl.apache.org/docs/2.0/api/Apache/RequestUtil.html#C_request_


sub fetch {
    my $class = shift;
    my $env = shift;
    unless (defined $env) {
        my $usage = 'Usage: Apache::Cookie->fetch($r): missing argument $r';

        if ($class->env eq "Apache::RequestRec") { # mp2
            $env = eval {Apache->request} or die <<EOD;
$usage: attempt to fetch global Apache->request failed: $@.
EOD
            # warn $usage;
        }
        else {
            die $usage;
        }
    }
    my $jar = $class->jar($env, @_);
    return wantarray ? %{(scalar $jar->cookie) || {}} : $jar->cookie;
}


If there are no objections to this, I'll commit the change in a day or two.
-- 
Joe Schaefer


Mime
View raw message