Cookies for LWPng
Tan Joo Geok (tjg@krdl.org.sg)
Thu, 14 Sep 2000 18:07:57 +0800
------=_NextPart_000_001B_01C01E76.B64010C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi.
I have been using the LWPng distribution which implements HTTP/1.1. I =
am wondering how to get the Cookie operations working for LWPng. I =
tried doing this:
#!/usr/bin/perl -w
require LWP;
require LWP::Debug;
use LWP::UA;
use LWP::UA::Cookies;
use LWP::Request;
use LWP::MainLoop qw(mainloop);
use HTTP::Cookies;
$ua =3D LWP::UA->new;
$ua->agent("Mozilla/8.0");
$ua->cookie_jar(HTTP::Cookies->new);
$url =3D "http://www.hotmail.com";
$timeout =3D 3*60;
$request =3D LWP::Request->new("GET");
$request->{'done_cb'} =3D sub { $response =3D shift;};
$request->url($url);
$ua->spool($request);
mainloop->one_event($timeout) until $response;
if ($response)
{
print "Main page done for $url\n";
if ($ua->cookie_jar->as_string)
{
print "Cookies found\n";
}=20
else
{
print "No Cookies found\n";
}
}
=20
=20
The error message I get is:
Can't locate object method "epath" via package "URI::http" at =
/usr/lib/perl5/site_perl/5.005/HTTP/Cookies.pm line 110. =
=20
Does anybody know what is the problem?
Thanks,
Joo Geok
------=_NextPart_000_001B_01C01E76.B64010C0--