[tpm] WWW::Mechanize and setting cookies

Zoffix Znet zoffix at zoffix.com
Thu Jul 31 17:56:19 PDT 2008

WWW::Mechanize uses LWP::UserAgent as base class, thus you'd call
$mech->cookie_jar to get the HTTP::Cookies object. Which comes to
$mech->cookie_jar->set_cookie( $version, $key, $val, $path, $domain,
$port, $path_spec, $secure, $maxage, $discard, \%rest );


On Thu, 2008-07-31 at 17:19 -0400, Madison Kelly wrote:
> Hi all,
>    I've run into the need to set some cookies for a WWW::Mechanize 
> object I am using. As I understand it, the default 'cookie_jar' is 
> supposed to be an instance of HTTP::Cookies, but I can't see where that 
> is implemented in the module. Despite that, I tried calling the 
> 'set_cookie' method but, as I expected, got an error saying that is not 
> a known method.
>    So dear TPM, can someone clue me in on how to set a bunch of cookies 
> using WWW::Mechanize?
> Bonus round!
>    If this is an HTTP::Cookies object, what pray tell is '$version' 
> supposed to be when setting the cookie? Beyond setting it, there is no 
> mention of it in the docs and the code merely shows it being set to '0' 
> in undef.
> Thanks as always!
> Madi
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm

More information about the toronto-pm mailing list