in reply to LWP::UserAgent cookies control

Searching LWP::UserAgent for jar points out $ua->cookie_jar - what problems did you have using this method that you want another?

Replies are listed 'Best First'.
Re^2: LWP::UserAgent cookies control
by DimOK (Novice) on Jul 10, 2009 at 07:22 UTC
    my bad, i even didn't think that i can use constructions like $ua->cookie_jar->clear_temporary_cookies and they will work :) Thank you very much!
      Looking at your original snippet, you can grab the output of your call to $ua->cookie_jar(...)
      my $ua = LWP::UserAgent->new; my $jar = $ua->cookie_jar({ file => $full_path_to_script_dir."/cookies", hide_cookie2 => 1, autosave => 1, ignore_discard => 1}); #... do surfing.... #edit jar $jar->clear_temporary_cookies
      If you happen to already have a cookie_jar object or want a non-standard one, you can create a cookie_jar and then add it to your UserAgent. Also, these tips also work for things that subclass LWP::UserAgent, like WWW::Mechanize.
      my $jar = MyCookieJar->new({ file => $path_to_cookies, %options }); # directly at new: my $ua = LWP::UserAgent->new( cookie_jar => $jar); # or later, via cookie_jar $ua->cookie_jar( $jar );