libwww-perl cookie_jar

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name Libwww-perl cookie jar
Ontology

The cookie_jar file is used by libwww-perl, a library for the Perl programming language to access Web pages, to store cookies when they are given by sites which are accessed, so they can be sent back as needed in further web accesses.

By default, libwww-perl ignores cookies, but you can enable them with the proper commands:

use LWP::UserAgent;
use HTTP::Cookies;

$ua = LWP::UserAgent->new;
$ua->cookie_jar(HTTP::Cookies->new(file => "cookie_jar",
                                   autosave => 1));

You can actually name the file whatever you want (lwpcookies.txt is suggested in the libwww-perl cookbook linked below), but "cookie_jar" seems to be a traditional name (real Unix geeks don't need no steenkin' file extensions).

The format is text-based, like this:

#LWP-Cookies-1.0
Set-Cookie3: stuff=1234567890; path="/"; domain=.test.example; path_spec; expires="2032-11-03 15:52:59Z"; version=0

The opening comment line "#LWP-Cookies-1.0" seems to be a signature sequence that can be used to check that a file is in fact a LWP cookie jar.

References

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox