Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: WWW::Mechanize and Cookies

by dorko (Parson)
on May 02, 2005 at 03:42 UTC ( #453119=note: print w/replies, xml ) Need Help??


in reply to WWW::Mechanize and Cookies

Hello buddyq,

A quick Google for "WWW::Mechanize cookies" found an article by Chris Ball as the first result. I quote:

As a note for your own experiments, WWW::Mechanize supports cookies - in that the requestor is a normal LWP::UserAgent object - but they aren't enabled by default. If you need to support cookies, then your script should call "use HTTP::Cookies; $agent->cookie_jar(HTTP::Cookies->new);" on your agent object in order to enable session-volatile cookies for your own code.
NOTE: I haven't used cookies with WWW::Mechanize, but I've used them with LWP. So take this post with a grain of salt.

Cheers,

Brent

-- Yeah, I'm a Delt.

Replies are listed 'Best First'.
Re^2: WWW::Mechanize and Cookies
by fokat (Deacon) on May 02, 2005 at 03:59 UTC
    NOTE: I haven't used cookies with WWW::Mechanize, but I've used them with LWP. So take this post with a grain of salt.

    I have used them and it works exactly as dorko's answer explain.

    Best regards

    -lem, but some call me fokat

      I use cookies with WWW::Mechanize, but not only saving cookies for the session, saving cookies for later sessions as set by the site's "remember me on this computer"* checkbox.

      my $browser = WWW::Mechanize->new( cookie_jar => { file => "$ENV{HOME}/.cookies.txt", autosave => 1 } );

      That script logged into the NY Times two years ago and has stayed logged in ever since.

      * It should be "remember me on this computer with this browser" of course, but what the hell...



      ($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
      =~y~b-v~a-z~s; print
Re^2: WWW::Mechanize and Cookies
by merlyn (Sage) on May 02, 2005 at 14:10 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://453119]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2018-07-20 20:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (441 votes). Check out past polls.

    Notices?