tornadoslims has asked for the wisdom of the Perl Monks concerning the following question:

Hi All - Im building a client-side yahoo mail reader in perl using Mail::Client::Yahoo. I'd like to be able to call the mechanize yahoo login object in one perl script, and then perform other functions (message send, recieve, what have you) in another script. The problem is I can't seem to save the session state and need to relogin each time I want to grab some more data from my yahoo account. Is there any way to save either the Mail::Client::Yahoo object ( I tried Storable- no luck) or the cookies from mechanize so I can stay logged in across script execution? Thanks Monks! Tornadoslims

Replies are listed 'Best First'.
Re: Mechanize or LWP Cookie Persistance
by Corion (Patriarch) on Jul 28, 2004 at 08:32 UTC

    LWP::UserAgent, and by inheritance WWW::Mechanize can store the cookie jar in a file. Just use

    my $agent = WWW::Mechanize->new( cookie_jar => { file => "$ENV{HOME}/. +yahoo_cookies.txt" } );

    The file will be created and updated automagically, and everything should be fine.