[San-diego-pm] Cookie problem
Chris Radcliff
chris_radcliff at mac.com
Thu Jul 15 09:26:49 CDT 2004
Hi Joel,
Cookies are sent with the result of your request (in the headers) and
read on the next request. The cookies you read on any given request
will only be those set previously, so you'll want to keep track of the
values internally as well.
Cheers,
~chris
On Jul 14, 2004, at 9:52 PM, Joel Fentin wrote:
> Using Apache personal server in my laptop (http://127.0.0.1) I run a
> perl script which creates a cookie in FireFox and then reads it.
> According to tools/options/cookies in FireFox, the cookies are made
> correctly.
>
> But the read cookie routine is always a cookie behind. It never reads
> the current cookie, but only the last (if there is a last cookie). I
> have also tried with $ENV{HTTP_COOKIE} and I get the same results.
>
> I tried a mess of variations but nothing works. What does it want?
>
> #======================================================================
> =====
> sub CreateCookie
> {
> my $SessionID = int(rand(99999999 - 10000000)+10000000);#generate 8
> digit number
> my %hash;
> $hash{'SessionID'} = $SessionID;
> my $Buf = $co->cookie
> (
> -name=>'ShopCart',
> -value=>\%hash,
> -expires=>'+30h'
> );
> print $co->header(-cookie=>$Buf);
> print $SessionID;
> }
>
> #======================================================================
> =====
> sub ReadCookie
> {
> #reads value pairs in cookie called ShopCart
> my %Buff;
> %Buff = $co->cookie('ShopCart');
> die map "$_ = $Buff{$_}\n", keys %Buff;
> }
>
> --
> Joel Fentin tel: 760-749-8863 FAX: 760-749-8864
> Contact me: http://fentin.com/me/ContactMe.html
> Biz: http://fentin.com
> Personal: http://fentin.com/me/
>
>
>
> _______________________________________________
> San-diego-pm mailing list
> San-diego-pm at pm.org
> http://www.pm.org/mailman/listinfo/san-diego-pm
More information about the San-Diego-pm
mailing list