No, they are enabled by default in Mechanize.
But you may need to do something goofy to OBTAIN the proper cookie(s)
because of however the site is set up.
I have a script that grabs some mutual fund information. I need to be
able to grab this page:
https://example.com/parts/nav/fund_performance.cfm
But, of course, I need a cookie. So I log-in like this:
$mech->get('https://example.com/parts/login_1.html');
$mech->field('userid', 'myuserid');
$mech->field('passwd', 'mypasswd');
$mech->field('javascriptenabled', 'true'); #liar!
$mech->submit;
And I thought that would have done the trick, but I found out that I
still didn't have the cookie I needed. I looked at the site's HTML (or
I could have used the TamperData plug-in for Firefox) and discovered
that I needed to do this extra step:
$mech->get('login_2.cfm'); #this sets a cookie or something
I don't know what that login_2.cfm does - I gather it drops the needed
cookie and then does a redirect or something. But I needed to do that
in order to fully authenticate the session. I just simply get() the
page; there's no form or anything on it, so I don't need to set fields
or submit anything. The simple act of get()ting this one extra page
allowed me to obtain the needed cookie.
Then I can grab and parse the info, and be fat, dumb, and happy with
something like:
my $info =
$mech->get('https://example.com/parts/nav/fund_performance_print.cfm')
->content;
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)