http://qs321.pair.com?node_id=11132410


in reply to Saving HTTP::Cookies into Netscape format using bless/re-bless

You could also use the scan() method to duplicate the stored cookies. It takes a callback which is invoked for each cookie and given arguments in the same order needed for set_cookie()
my $cookie_jar = HTTP::Cookies->new(); # ... my $netscape_cookie_jar = HTTP::Cookies::Netscape->new(); my $callback = sub { $netscape_cookie_jar->set_cookie(@_); }; $cookie_jar->scan( $callback ); $netscape_cookie_jar->save("mycookies.txt");