HTTP::Cookies::Netscape->save()
Jeremy D. Impson (jdimpson@source.syr.edu)
Mon, 15 Feb 1999 22:28:10 -0500 (EST)
Is discussing HTTP::* on-topic for this list? I forget if HTTP comes
bundled with LWP or no...
At the risk of being off-topic, I'll ask anyway :)
I'm using HTTP::Cookies version 1.5 (someone flame me if this problem is
gone in more recent versions).
The behaviours of HTTP::Cookies->save() and
HTTP::Cookies::Netscape->save() are subtly different.
HTTP::Cookies->save() just prints to a file the output of
HTTP::Cookies->as_string(), while HTTP::Cookies::Netscape->save() uses a
special callback subroutine that prints out to the cookie file in
Netscape's format. However, there is one line that goes:
return if $now > $expires;
resulting in the cookie not being written to the file.
I suppose this is makes some sense, but there is no such action taken in
HTTP::Cookies->save() (at least, not that I saw, and certainly, for a
cookie that HTTP::Cookies::Netscape->save() discards due to expiration,
HTTP::Cookies->save() does not).
I would prefer that the callback did _not_ make this decision; the
application should decide. However, I'd be just as happy with a
"'ignore_expires' => 1" option to new() that causes the expire value to be
ignored (but the expire value still inserted into the cookie file).
If the powers that be prefer one or the other, I'd be happy to code it up.
I'd really like a way to write the cookie to Netscape's bookmark file.
I'm writing a program to log in to Excite's email system. It writes the
cookies and then using Netscape I don't have to login by hand. I've tried
hardcoding the cookie into Netscape's cookie file, and it works (until
removed by Netscape later).
(Now I just have to figure out how to get Netscape to reload the cookie
file without having to restart it.)
--Jeremy
---------------------------------------------------------------------------
Jeremy Impson Linux, Perl, and Network geek
jdimpson@source.syr.edu http://source.syr.edu/~jdimpson