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

Re: [MacPerl] cookie-help needed



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 2:21 PM +0100 1/21/98, Anders Gardebring wrote:

} 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.

You might want to take a look at HTTP::Cookies, which you already have if
you have a recent version of MacPerl.  I've never used it, but since it's
part of libwww-perl-5, I'm sure it works for the client side.  You might
get some ideas on how to handle them from the pod and the code.

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

- -----
Paul J. Schinder
schinder@pobox.com


-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBNMYSylZaVc52j0XhEQIM5QCfVEZjkc7cUamsd9vkihlEfstDTfsAn0P/
zf+JmLW5PtPbxsoPp3J5xUH5
=Rw+E
-----END PGP SIGNATURE-----


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