How can I print the cookie_jar values in Perl's WWW::Mechanize?

Posted by Phill Pafford on Stack Overflow See other posts from Stack Overflow or by Phill Pafford
Published on 2010-04-22T18:49:38Z Indexed on 2010/04/22 19:23 UTC
Read the original article Hit count: 229

Filed under:
|

How can I print the values of the cookie/cookie_jar being set?

Trying:

##my $cookie_jar=HTTP::Cookies->new(file => "cookie.jar",autosave=>1,ignore_discard=>1);
my $cookie_jar=HTTP::Cookies->new(); ## Would like it to be in memory
my $agent = WWW::Mechanize->new(cookie_jar => $cookie_jar);

##my $agent = WWW::Mechanize->new();
##my $agent = WWW::Mechanize->new(autocheck => 1);

##$agent->cookie_jar( {} );

# we need cookies
##$agent->cookie_jar(HTTP::Cookies->new);

print "Set Cookie Jar?\n";
print $agent->cookie_jar->as_string();
print "\n";

$agent->get($url); // url is a https site

Not too much luck with any of these, what am I doing wrong?

© Stack Overflow or respective owner

Related posts about perl

Related posts about cookies