http://www.perlmonks.org?node_id=367135


in reply to Cookiejar for www::mechanize

You can create an in-memory cookie jar using the constructor of WWW::Mechanize. Using an existing cookie jar, you can use the HTTP::Cookies module. The file format this module uses is different from, for example, Mozilla. You can use HTTP::Cookies::Netscape or HTTP::Cookies::Explorer to read these browser-specific files.

Using an existing file of cookies with WWW::Mechanize can be done as follows:

... my $agent = WWW::Mechanize->new(); my $cj = HTTP::Cookies->new(file => "/file/to/cookie_jar"); $agent->cookie_jar($cj); ...
(Substitute HTTP::Cookies::Netscape or HTTP::Cookies::Explorer to use a cookie file from those browsers.

Arjen