use strict; use warnings; use LWP::UserAgent; use HTTP::Cookies; # .... my declarations snipped ... my $cjar = HTTP::Cookies->new(); my $ua = LWP::UserAgent->new(keep_alive => '1', timeout => $timeout); $url = "http://$host"; $error {public_home} {url} = $url; $req = HTTP::Request->new(GET => $url); $req->content_type('application/x-www-form-urlencoded'); #$cjar->add_cookie_header($req); $t0 = time; $resp = $ua->send_request($req); $t1= time; $error {public_home} {rt} = $t1 - $t0; $ua->cookie_jar($cjar); $cjar->extract_cookies($resp); print $cjar->as_string; exit;