Hello everyone!
I have a question about LWP::Parallel::UserAgent and cookie jars using
HTTP::Cookies.
Can I use cookie jars with LWP::Parallel::UserAgent? Can it be used in
the same way as I do with LWP::UserAgent?
I have a script whick I know definitely works because I can see the
cookies being stored in the cookies.txt file.
use LWP::UserAgent;
require HTTP::Cookies;
my $jar = new HTTP::Cookies(file => 'cookies.txt', autosave => 1);
my $ua = new LWP::UserAgent;
$ua->cookie_jar( $jar );
for (1 .. 10)
{
my $req = new
HTTP::Request(GET => 'http://www.something.com/index.html');
$ua->request($req);
}
However, when I do the same with LWP::Parallel::UserAgent as in the
script below, nothing gets saved to the cookies.txt file:
use LWP::Parallel::UserAgent;
require HTTP::Cookies;
my $jar = new HTTP::Cookies(file => 'cookies.txt', autosave => 1);
my $ua = new LWP::Parallel::UserAgent;
$ua->cookie_jar( $jar );
for (1 .. 10)
{
my $req = new
HTTP::Request(GET => 'http://www.something.com/index.html');
$ua->register($req);
$ua->wait(100);
}
Can someone please shed some light on how the 2 modules treat
cookies/cookie jars differently?
Regards,
Ashisih