[thelist] cookies in Perl
Dougal Campbell
dougal at gunters.org
Fri Sep 6 13:42:01 CDT 2002
On Fri, 6 Sep 2002, Marc Seyon wrote:
> Guys,
>
> Colleague of mine is a bit stumped and I thought I'd ask the list for some
> help. He's trying to set a cookie in perl, using this approach
>
> $cookie_jar->set_cookie($version, $key, $val, $path, $domain, $port,
> $path_spec, $secure, $maxage, $discard, \%rest)
>
> (referenced at http://www.perldoc.com/perl5.8.0/lib/HTTP/Cookies.html)
>
> But he doesn't know what the first three variables are about. That is,
> $version, $key and $val.
Check the RFC mentioned:
<URL:http://www.ietf.org/rfc/rfc2965.txt>
It looks like $version only applies to the Cookie2 spec (you probably
want $version=1), and $key and $val are the name and value for your
cookie.
Standard usage would probably be something like:
## Not sure about the 'hide_cookie2' bit....
$cookie_jar = HTTP::Cookies->new(hide_cookie2 => 1);
$cookie_jar->set_cookie(
1, # version
'username', # key
'joe', # value
'', # path
'www.example.com', # domain
'80', # port
0, # path_spec
0, # secure
3600, # maxage
0, # discard
{} # rest
);
Just a guess....
--
Ernest MacDougal Campbell III, MCP+I, MCSE <dougal at gunters.org>
http://dougal.gunters.org/ http://spam.gunters.org/
Web Design & Development: http://www.mentalcollective.com/
This message is guaranteed to be 100% eror frea!
More information about the thelist
mailing list