Subject: | HTTP::Cookies needs improved magic |
HTTP::Cookies can't read a Mozilla cookies file. The file
is the same format as a Netscape cookies file minus the
word "Netscape" in the first line of the cookie file. The
HTTP::Cookies::Netscape::load method can handle this easily
though:
three_brian[192]$ diff Cookies.pm.old Cookies.pm
9c9,10
< $VERSION = sprintf("%d.%02d", q$Revision: 1.25 $ =~ /(\d+)\.(\d+)/);
---
Show quoted text
> #$VERSION = sprintf("%d.%02d", q$Revision: 1.25 $ =~ /(\d+)\.(\d+)/);
> $VERSION = 1.26;
745c746
< unless ($magic =~ /^\# Netscape HTTP Cookie File/) {
---
Show quoted text> unless ($magic =~ /^\#(?: Netscape)? HTTP Cookie File/) {
However, this is only a band-aid. HTTP::Cookies should be able to
identify the type of file before it calls load. Once it recognizes
the file type, it can re-bless the object then call load. This
way, HTTP::Cookies::Netscape::load just has to skip all leading
comments to start reading cookies, no matter the browser. The
programmer does not have to know ahead of time what program created
the cookie file either.