[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] cookie-help needed



Hi!

Im in an urgent need of help when it comes to set and read cookies.
I've read through a whole lot of documentation, but just cant get it to work.
This is my code so far:
---------
# set a cookie:
print "Set-Cookie: name=value";

----------
# read a cookie
sub gimme_cookie;
gimme_cookie;
$name = $cookie{'name'};

# print result:
print "$name";

# Get cookie:
sub gimme_cookie
{
    my (@par, $namn, $varde);
return unless $ENV{'HTTP_COOKIE'};

@par = split (/; /,$ENV{'HTTP_COOKIE'});

foreach $par (@par)
{

($namn, $varde) = split(/=/, $par);

foreach $x ($namn, $varde)
  {$x =~ s/%([0-9A-F]{2})/chr(hex($1))/egi;}

$cookie{$namn}=$varde unless $cookie{$namn};
}
}

----------




---------------------------------------------o00o-o00o--
   Anders Gardebring; UIN: 3767919
   http://www.turboanders.ml.org
--------------------------------------------------------

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch