I recently had occasion to want to have an LWP client that had its own 
cookie jar file, in LWP cookie jar format, but I wanted to start off its 
disk file with the contents of my Netscape cookies file.

After some poking around, I stumbled on the following way to do it, which 
I'm posting in case anyone else needs to do this.  It throws a few 
warnings, but otherwise seems fine:

use LWP;
use HTTP::Cookies;
my $in =  'C:/Program Files/Netscape/Users/sburke/cookies.txt';
my $out = 'c:/plib/LWP/cookies.lwp';
my $c = HTTP::Cookies::Netscape->new;
$c->load($in);
$c->HTTP::Cookies::save($out);
exit;



And from then on, just use that new cookie jar file like so:

   use HTTP::Cookies;
   $browser->cookie_jar( HTTP::Cookies->new(
     'file' => '/some/where/cookies.lwp',
         # where to read/write cookies
     'autosave' => 1,
         # save it to disk when done
   ));

--
Sean M. Burke    http://www.spinn.net/~sburke/

Reply via email to