Cookies.pm netscape cookie format help

Russell Locke (rlocke@hbs.edu)
Tue, 8 Jun 1999 10:50:28 -0400


I'm attempting to use Cookies.pm with libwww-perl and Java. In my java
project I can capture my current cookies and so I'm writing them out in
Netscape cookie format to a temp file. The file format looks like:

# Netscape HTTP Cookie File
# http://www.netscape.com/newsref/std/cookie_spec.html
# This is a generated file!  Do not edit.

.hbs.edu FALSE / FALSE 1077147897 HBSCOOLCOOKIE
rlocke@business.hbs.edu:928846504:DbLxBTWog
.hbs.edu FALSE / FALSE 1077147897 dyn_sid 5928846542

Then through some magically process eventually the Cookies.pm opens the
temp file. What I found was that the HTTP::Cookies::Netscape->load would
read the entire file as one line, therefore finding no cookies. To
confirm, I commented out the Netscape Cookie.txt header check code and
made my temp file only have one line, which was one cookie. Great
everything works... nice hack but I would prefer that Cookies.pm works
as it should. So my question is what am I doing wrong when I create the
temp file. My code is as follows....

ckwrite.write("# Netscape HTTP Cookie File\n");
ckwrite.write("# http://www.netscape.com/newsref/std/cookie_spec.html\n");
ckwrite.write("# This is a generated file!  Do not edit.\n\n");
ckwrite.write(".hbs.edu\tFALSE\t/\tFALSE\t1077147897\tHBSCOOLCOOKIE\t"+
	requestData.get"HBSCOOLCOOKIE").toString() + "\n");
ckwrite.write(".hbs.edu\tFALSE\t/\tFALSE\t1077147897\tdyn_sid\t"+
	requestData.get("dyn_id").toString() + "\n");

Is '\n' not the correct end of line code? What is the solution. I looked
at the HTTP::Cookies::Netscape->save code and it is using '\n'. The
Cookies.pm seems fine.... at least code wise it does... the load module
is supposed to read line by line from the file according to the code
'$_'.

Any help would be greatly appreciated.

- Russ

---------------------------------------------------
Of course I don't look busy - I did it right the first time.
---------------------------------------------------

Russell Locke
ITG - Software Engineering

EMail: rlocke@hbs.edu
Phone: 617.495.6994
Fax: 603.688.6053
Internet: www.people.hbs.edu/rlocke

Harvard Business School
Cotting 213
Soldiers Field Rd.
Boston, Massachusetts 02163
USA