[tpm] WWW::Mechanize and setting cookies

Madison Kelly linux at alteeve.com
Thu Jul 31 21:07:39 PDT 2008

Zoffix Znet wrote:
> 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 );
> Cheers.


   Thanks for this! It seems to make more sense but it still doesn't 
seem to work for me. Here is how I've updated the code I originally 
quoted in my reply to Adam:

# Removed the 'HTTP::Cookies' reference
my $agent = WWW::Mechanize->new(autocheck => 1);
# Changed this to your recommendation.
$agent->cookie_jar->set_cookie(0, $variable, $value, $path);



More information about the toronto-pm mailing list