{
    "content": [
        {
            "type": "text",
            "text": "# HTTP::Cookies (perldoc)\n\n## NAME\n\nHTTP::Cookies - HTTP cookie jars\n\n## SYNOPSIS\n\nuse HTTP::Cookies;\n$cookiejar = HTTP::Cookies->new(\nfile => \"$ENV{'HOME'}/lwpcookies.dat\",\nautosave => 1,\n);\nuse LWP;\nmy $browser = LWP::UserAgent->new;\n$browser->cookiejar($cookiejar);\nOr for an empty and temporary cookie jar:\nuse LWP;\nmy $browser = LWP::UserAgent->new;\n$browser->cookiejar( {} );\n\n## DESCRIPTION\n\nThis class is for objects that represent a \"cookie jar\" -- that is, a database of all the HTTP\ncookies that a given LWP::UserAgent object knows about.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **LIMITATIONS**\n- **METHODS**\n- **SEE ALSO**\n- **AUTHOR**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "HTTP::Cookies",
        "section": "",
        "mode": "perldoc",
        "summary": "HTTP::Cookies - HTTP cookie jars",
        "synopsis": "use HTTP::Cookies;\n$cookiejar = HTTP::Cookies->new(\nfile => \"$ENV{'HOME'}/lwpcookies.dat\",\nautosave => 1,\n);\nuse LWP;\nmy $browser = LWP::UserAgent->new;\n$browser->cookiejar($cookiejar);\nOr for an empty and temporary cookie jar:\nuse LWP;\nmy $browser = LWP::UserAgent->new;\n$browser->cookiejar( {} );",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "LIMITATIONS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 102,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "HTTP::Cookies - HTTP cookie jars\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 6.10\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use HTTP::Cookies;\n$cookiejar = HTTP::Cookies->new(\nfile => \"$ENV{'HOME'}/lwpcookies.dat\",\nautosave => 1,\n);\n\nuse LWP;\nmy $browser = LWP::UserAgent->new;\n$browser->cookiejar($cookiejar);\n\nOr for an empty and temporary cookie jar:\n\nuse LWP;\nmy $browser = LWP::UserAgent->new;\n$browser->cookiejar( {} );\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This class is for objects that represent a \"cookie jar\" -- that is, a database of all the HTTP\ncookies that a given LWP::UserAgent object knows about.\n\nCookies are a general mechanism which server side connections can use to both store and retrieve\ninformation on the client side of the connection. For more information about cookies refer to\nCookie Spec <http://curl.haxx.se/rfc/cookiespec.html> and Cookie Central\n<http://www.cookiecentral.com>. This module also implements the new style cookies described in\nRFC 2965 <https://tools.ietf.org/html/rfc2965>. The two variants of cookies are supposed to be\nable to coexist happily.\n\nInstances of the class *HTTP::Cookies* are able to store a collection of Set-Cookie2: and\nSet-Cookie: headers and are able to use this information to initialize Cookie-headers in\n*HTTP::Request* objects. The state of a *HTTP::Cookies* object can be saved in and restored from\nfiles.\n",
                "subsections": []
            },
            "LIMITATIONS": {
                "content": "This module does not support Public Suffix <https://publicsuffix.org/> encouraged by a more\nrecent standard, RFC 6265 <https://tools.ietf.org/html/rfc6265>.\n\nThis module's shortcomings mean that a malicious Web site can set cookies to track your user\nagent across all sites under a top level domain. See t/publicsuffix.t in this module's\ndistribution for details.\n\nHTTP::CookieJar::LWP supports Public Suffix, but only provides a limited subset of this module's\nfunctionality and does not support standards older than *RFC 6265*.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "The following methods are provided:\n\n$cookiejar = HTTP::Cookies->new\nThe constructor takes hash style parameters. The following parameters are recognized:\n\nfile:            name of the file to restore cookies from and save cookies to\nautosave:        save during destruction (bool)\nignorediscard:  save even cookies that are requested to be discarded (bool)\nhidecookie2:    do not add Cookie2 header to requests\n\nFuture parameters might include (not yet implemented):\n\nmaxcookies               300\nmaxcookiesperdomain    20\nmaxcookiesize           4096\n\nnocookies   list of domain names that we never return cookies to\n\n$cookiejar->getcookies( $urlordomain )\n$cookiejar->getcookies( $urlordomain, $cookiekey,... )\nReturns a hash of the cookies that applies to the given URL. If a domainname is given as\nargument, then a prefix of \"https://\" is assumed.\n\nIf one or more $cookiekey parameters are provided return the given values, or \"undef\" if\nthe cookie isn't available.\n\n$cookiejar->addcookieheader( $request )\nThe addcookieheader() method will set the appropriate Cookie:-header for the\n*HTTP::Request* object given as argument. The $request must have a valid url attribute\nbefore this method is called.\n\n$cookiejar->extractcookies( $response )\nThe extractcookies() method will look for Set-Cookie: and Set-Cookie2: headers in the\n*HTTP::Response* object passed as argument. Any of these headers that are found are used to\nupdate the state of the $cookiejar.\n\n$cookiejar->setcookie( $version, $key, $val, $path, $domain, $port, $pathspec, $secure,\n$maxage, $discard, \\%rest )\nThe setcookie() method updates the state of the $cookiejar. The $key, $val, $domain, $port\nand $path arguments are strings. The $pathspec, $secure, $discard arguments are boolean\nvalues. The $maxage value is a number indicating number of seconds that this cookie will\nlive. A value of $maxage <= 0 will delete this cookie. The $version argument sets the\nversion of the cookie; the default value is 0 ( original Netscape spec ). Setting $version\nto another value indicates the RFC to which the cookie conforms (e.g. version 1 for RFC\n2109). %rest defines various other attributes like \"Comment\" and \"CommentURL\".\n\n$cookiejar->save\n$cookiejar->save( $file )\n$cookiejar->save( file => $file, ignorediscard => $ignorediscard )\nThis method file saves the state of the $cookiejar to a file. The state can then be\nrestored later using the load() method. If a filename is not specified we will use the name\nspecified during construction. If the $ignorediscard value is true (or not specified, but\nattribute *ignorediscard* was set at cookie jar construction), then we will even save\ncookies that are marked to be discarded.\n\nThe default is to save a sequence of \"Set-Cookie3\" lines. \"Set-Cookie3\" is a proprietary LWP\nformat, not known to be compatible with any browser. The *HTTP::Cookies::Netscape* sub-class\ncan be used to save in a format compatible with Netscape.\n\n$cookiejar->load\n$cookiejar->load( $file )\nThis method reads the cookies from the file and adds them to the $cookiejar. The file must\nbe in the format written by the save() method.\n\n$cookiejar->revert\nThis method empties the $cookiejar and re-loads the $cookiejar from the last save file.\n\n$cookiejar->clear\n$cookiejar->clear( $domain )\n$cookiejar->clear( $domain, $path )\n$cookiejar->clear( $domain, $path, $key )\nInvoking this method without arguments will empty the whole $cookiejar. If given a single\nargument only cookies belonging to that domain will be removed. If given two arguments,\ncookies belonging to the specified path within that domain are removed. If given three\narguments, then the cookie with the specified key, path and domain is removed.\n\n$cookiejar->cleartemporarycookies\nDiscard all temporary cookies. Scans for all cookies in the jar with either no expire field\nor a true \"discard\" flag. To be called when the user agent shuts down according to RFC 2965.\n\n$cookiejar->scan( \\&callback )\nThe argument is a subroutine that will be invoked for each cookie stored in the $cookiejar.\nThe subroutine will be invoked with the following arguments:\n\n0  version\n1  key\n2  val\n3  path\n4  domain\n5  port\n6  pathspec\n7  secure\n8  expires\n9  discard\n10  hash\n\n$cookiejar->asstring\n$cookiejar->asstring( $skipdiscardables )\nThe asstring() method will return the state of the $cookiejar represented as a sequence of\n\"Set-Cookie3\" header lines separated by \"\\n\". If $skipdiscardables is TRUE, it will not\nreturn lines for cookies with the *Discard* attribute.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "HTTP::Cookies::Netscape, HTTP::Cookies::Microsoft\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Gisle Aas <gisle@activestate.com>\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "This software is copyright (c) 2002 by Gisle Aas.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
                "subsections": []
            }
        }
    }
}