logo       

Re: Download manager - problem solved: msg#00037

lang.perl.modules.lwp

Subject: Re: Download manager - problem solved

From: "Gisle Aas" <gisle@xxxxxxxxxxxxxxx>

Just enable the cookie jar, with $ua->cookie_jar({}), and LWP will
manage the cookies for you.
--

Ok, I have tried that, but it still doesn't work as I want. I would like to
do something like the following code does in case the $request and $response
vars are initialised:

#Send the cookies to the site:
if (-e $cookies_file) {
$cookie_jar -> load($cookies_file);
$cookie_jar->add_cookie_header($request);
}

#Get the cookies
if($cookies_file) {
$cookie_jar->extract_cookies($response);
$cookie_jar -> save($cookies_file);
}

If I just use the following code, this doesn't save a cookies.txt file:

my $cookies_file = "cookies.txt";
$cookie_jar = HTTP::Cookies -> new(3, $cookies_file, autosave => 1,
ignore_discard => 1);
$ua->cookie_jar({});

Thank you.

Teddy




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise