use LWP::UserAgent;
use HTTP::Cookies;

my $ua = LWP::UserAgent->new;
$ua->cookie_jar(HTTP::Cookies->new);

my $res = $ua->request(HTTP::Request->new(GET => "http://localhost/xxx.html";));
print $res->as_string;

print "-----\n", $ua->cookie_jar->as_string, "-----\n";

$res = $ua->request(HTTP::Request->new(TRACE => "http://localhost/";));

print $res->as_string;




HTTP/1.1 200 OK
Connection: close
Date: Wed, 05 Sep 2001 21:30:54 GMT
Accept-Ranges: bytes
Server: Apache/1.3.12 (Unix)  (Red Hat/Linux)
Content-Length: 84
Content-Type: text/html
ETag: "2499a-54-3b9694de"
Last-Modified: Wed, 05 Sep 2001 21:10:54 GMT
Client-Date: Wed, 05 Sep 2001 21:30:54 GMT
Client-Peer: 127.0.0.1:80
Set-Cookie: hash=KMvJWfpPpqhgOEdU

<META http-equiv="Set-Cookie" content="hash=KMvJWfpPpqhgOEdU">

This is some text.


-----
Set-Cookie3: hash=KMvJWfpPpqhgOEdU; path="/"; domain="localhost.local"; discard; version=0
-----
HTTP/1.1 200 OK
Connection: close
Date: Wed, 05 Sep 2001 21:30:54 GMT
Server: Apache/1.3.12 (Unix)  (Red Hat/Linux)
Content-Type: message/http
Client-Date: Wed, 05 Sep 2001 21:30:54 GMT
Client-Peer: 127.0.0.1:80

TRACE / HTTP/1.0
Cookie: hash=KMvJWfpPpqhgOEdU
Cookie2: $Version="1"
Host: localhost
User-Agent: libwww-perl/5.5395


Reply via email to