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 Casper Bergenhammer <ca...@sophistic.dk> on 2004/06/19 14:33:13 UTC

Apache::Cookie problem report (2.03_04-dev)

apreq version: 2.03r04
system: freebsd4.10, apache2.0.49_02, perl 5.8.4, mod_perl2-1.99r14
note: apache started fine having use Apache::compat; in the startup.pl

problem: visiting an uri using Apache::Cookie will give "500 internal server
error" to the browser and and the following entry in the apache error log:
"Usage: $class->jar($env, $data)  a
/usr/local/lib/perl5/site_perl/5.8.4/mach/Apache2/Apache/Cookie.pm line
53.\n"

Is this caused by an error in the .pm using Apache::Cookie or is this an
error in libapreq2/Apache::Cookie ?

note: The same implementation is working in a
Apache1.3/mod_perl1/libapreq1.3 system.

--
Casper





Re: Apache::Cookie problem report (2.03_04-dev)

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Joe Schaefer <jo...@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


Re: Apache::Cookie problem report (2.03_04-dev)

Posted by Joe Schaefer <jo...@sunstarsys.com>.
"Casper Bergenhammer" <ca...@sophistic.dk> writes:

> problem: visiting an uri using Apache::Cookie will give "500 internal server
> error" to the browser and and the following entry in the apache error log:
> "Usage: $class->jar($env, $data)  a
> /usr/local/lib/perl5/site_perl/5.8.4/mach/Apache2/Apache/Cookie.pm line
> 53.\n"
> 
> Is this caused by an error in the .pm using Apache::Cookie or is this an
> error in libapreq2/Apache::Cookie ?
>
> note: The same implementation is working in a
> Apache1.3/mod_perl1/libapreq1.3 system.

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.

-- 
Joe Schaefer