Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Cannot create a cookie using HTTP::Cookiesby shagbark (Acolyte) |
on Aug 25, 2015 at 02:21 UTC ( [id://1139760]=perlquestion: print w/replies, xml ) | Need Help?? |
shagbark has asked for the wisdom of the Perl Monks concerning the following question: LWP::UserAgent uses HTTP::Cookies to create cookies. HTTP::Cookies has 4 ways for you to load a cookie: 1. Load it from an LWP-format file, a format known as "Set-Cookie3". This is impractical, since the format is not documented anywhere that I can find. 2. Set it using HTTP::Cookies->set_cookie( $version, $key, $val, $path, $domain, $port, $path_spec, $secure, $maxage, $discard, \%rest ). The documentation says, "The set_cookie() method updates the state of the $cookie_jar. The $key, $val, $domain, $port and $path arguments are strings. The $path_spec, $secure, $discard arguments are boolean values. The $maxage value is a number indicating number of seconds that this cookie will live. A value <= 0 will delete this cookie. %rest defines various other attributes like "Comment" and "CommentURL". To use this, I would need to know what the arguments $path_spec and $discard mean, what $version should be set to, and what to set $port to if I want the cookie to work for any port, as cookies generally do. 3. Create the cookie in Firefox and load it from the resulting Netscape-format file. This is impossible, since Firefox and Chrome now both store cookies in sqlite. 4. Create a Netscape cookie by hand in a file, using the file format given here: http://www.cookiecentral.com/faq/#3.5 Then load this in like so: my $cookieJar = HTTP::Cookies::Netscape->new(file => 'cookies.netscape'); When I do this, with the file where \t is a tab, I get the error message
How do you create a cookie to use with LWP::UserAgent?
Back to
Seekers of Perl Wisdom
|
|