Re: Cookies.pm netscape cookie format help

Russell Locke (rlocke@hbs.edu)
Wed, 9 Jun 1999 15:34:07 -0400


I like this fix better.... please disreguard my previous patch...

Thanks Gisle...

- Russ

At 8:10 PM +0200 6/9/99, Gisle Aas wrote:
>Russell Locke <rlocke@hbs.edu> writes:
>
>> How I found out that the entire file is being read in as one line....
>
>It looks like HTTP::Cookies could use this patch:
>
>Index: lib/HTTP/Cookies.pm
>===================================================================
>RCS file: /home/cvs/aas/perl/mods/libwww-perl/lib/HTTP/Cookies.pm,v
>retrieving revision 1.10
>diff -u -u -r1.10 Cookies.pm
>--- Cookies.pm	1999/03/20 07:37:35	1.10
>+++ Cookies.pm	1999/06/09 18:02:27
>@@ -485,6 +485,7 @@
>     my $self = shift;
>     my $file = shift || $self->{'file'} || return;
>     local(*FILE, $_);
>+    local $/ = "\n";  # make sure we got standard record separator
>     open(FILE, $file) or return;
>     my $magic = <FILE>;
>     unless ($magic =~ /^\#LWP-Cookies-(\d+\.\d+)/) {
>@@ -691,6 +692,7 @@
>     my($self, $file) = @_;
>     $file ||= $self->{'file'} || return;
>     local(*FILE, $_);
>+    local $/ = "\n";  # make we got standard record separator
>     my @cookies;
>     open(FILE, $file) || return;
>     my $magic = <FILE>;
>
>I really hate these kind of bugs.  Perl should somehow have treated
>these variables like it now does for $[.  I wonder how many modules
>use print without making sure $, and $\ have their standard values
>first.
>
>Regards,
>Gisle


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