in reply to Re^2: LWP::UserAgent cookies control
in thread LWP::UserAgent cookies control
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 $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
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 );
|
|---|