Hi Chris,
Just create a cookie jar of your own, then pass it into $mech at
creation time.
my $cj = HTTP::Cookies->new();
my $mech = WWW::Mechanize->new ( cookie_jar => $cj )
The name cookie_jar is documented, so you can probably safely use the
cookie jar that $mech creates for you.
Cheers,
Peter
Christopher Hart wrote:
Thanks Peter. What I'm having trouble with is finding how to get
access to the cookie jar that WWW::Mechanize maintains. I'm familiar
with using HTTP::Cookies with LWP and manually creating cookies, but I
can't find how/where the Mechanize module makes this object available
through its interface. Do you have any ideas on that? Any help is
appreciaed.
Thanks!
On 6/18/06, Peter Stevens <[EMAIL PROTECTED]> wrote:
Hi Chris,
From
http://search.cpan.org/~gaas/libwww-perl-5.805/lib/HTTP/Cookies.pm
(HTTP::Cookies):
$cookie_jar->set_cookie( $version, $key, $val, $path, $domain, $port,
$path_spec, $secure, $maxage, $discard, \%rest )
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". Googling for cookie_jar->set_cookie
produces a
few hundred pages - one of them should do ;-)
Cheers,
Peter
Christopher Hart wrote:
Hello,
I need to simulate some JavaScript that creates a cookie using
WWW::Mechanize. How can I programmatically add a cookie to the
in-memory cookie jar? I searched around for some examples on this,
but wasn't able to find anything.
Any help is appreciated. Thanks!
Chris
--
----------------------------------------------------------------------
Peter Stevens The Free Cell Phone Monitoring Service
www.MinuteWatcher.com
--
----------------------------------------------------------------------
Peter Stevens The Free Cell Phone Monitoring Service
www.MinuteWatcher.com