Philippe Bruhat (BooK)


mergecookies - Merge all your cookies for all of your browsers


mergecookies [ --config file ] [ --verbose ]


mergecookies reads all your cookie files for which a HTTP::Cookies module exists and is installed, merges all the cookies (if two identical cookies (same name, same domain) are found, the one that expires the later is kept) and saves them back in each cookie file.

This way you can share your cookies between all your browsers.

The configuration file looks like the following:

    # filenames are relative to $ENV{HOME} or absolute
    Netscape     .netscape/cookies
    Mozilla      .mozilla/book/kdtqv86o.slt/cookies.txt
    Mozilla      .phoenix/default/bt7ivopl.slt/cookies.txt

    # file in the HTTP::Cookies format
    LWP          /tmp/lwp-cookies.txt

    # there is no HTTP::Cookies::Opera for now :-(
    #Opera        /home/book/.opera/cookies4.dat

Each line holds the name of the HTTP::Cookies module (Mozilla for HTTP::Cookies::Mozilla and so on) used to read the cookie file and the path of the file (absolute or relative to $ENV{HOME}). Cookies saved with HTTP::Cookies require the LWP keyword.


mergecookies accepts the following command-line options:

--config file

Read an alternate configuration file.


Print the list of cookies handled by the script.


Philippe "BooK" Bruhat <>

This script was created as an example of use for the HTTP::Cookies modules. Version 0.01 appeared in GNU/Linux Magazine France 57 (in French).


This module is free software; you can redistribute it or modify it under the same terms as Perl itself.