[San-diego-pm] Cookie problem

Joel Fentin joel at fentin.com
Wed Jul 14 23:52:37 CDT 2004

Using Apache personal server in my laptop ( 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

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
   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/

More information about the San-Diego-pm mailing list