in reply to HTTP::Request and caching...
I fixed up the object allocation and ran this on a timeserver that updates once per second. Had no problems.
Note that there is no need to explicitly process 301 redirects. LWP::UserAgent handles these automaticly. From LWP::UserAgentmy $ua = LWP::UserAgent->new( agent => 'Mozilla/4.0 (compatible; MSIE 6.0; Win32)'); while () { my $string=get_response( $url, $ua); $string=~/\d+:\d+:\d+/; print $&,"\n"; }; sub get_response { my ( $url, $ua ) = @_; my $request = HTTP::Request->new( GET => $url ); my $response=$ua->request($request); return $response->as_string; };
"The request() method will process redirects and authentication responses transparently."
|
|---|