Hi,

I'm using a CGI script which makes a call to raw_cookie(). When I run in CGI
mode everything works fine, and the cookie which matches $ENV{HTTP_COOKIE}
is returned.

When I run in mod_perl though, a cookie from a previous CGI instance is
returned. I took a look at CGI.pm to see what's going on and it has (my
comment added for emphasis):

    sub raw_cookie {
        my($self,$key) = self_or_CGI(@_);

        require CGI::Cookie;

        if (defined($key)) {
            # *************** Here is my problem ***********************
            # this fetch does not get executed because the
#self->{'.raw_cookies'} already exists
            $self->{'.raw_cookies'} = CGI::Cookie->raw_fetch  unless
$self->{'.raw_cookies'};

            return () unless $self->{'.raw_cookies'};
            return () unless $self->{'.raw_cookies'}->{$key};
            return $self->{'.raw_cookies'}->{$key};
        }
        return $self->http('cookie') || $ENV{'COOKIE'} || '';
    }

So I put some warns in here, and sure enough when it gets the wrong info,
$self->{'.raw_cookies'} already exists.

I've skimmed the documentation, particularly Mr. Beckman's stuff which I
think is quite good. The only thing I see which seems relevant is the page
about using PerlPostReadRequestHandler

http://thingy.kcilink.com/modperlguide/troubleshooting/Can_t_call_method_reg
ister_clea.html

but I don't get the error message specified, and I tried recompiling with
PERL_POST_READ_REQUEST=1 and setting the handler in httpd.conf.but that
seems ed to have no effect.

I realize I can simply call CGI::Cookie->raw_fetch() myself, but it bothers
me that there is some kind of persistence going on which probably is an
indicator that I'll be hosed in some other way once I get around this
problem.

Help please...

Thanks,
Lance


Reply via email to