http://qs321.pair.com?node_id=277381

c has asked for the wisdom of the Perl Monks concerning the following question:

I'm starting a small project wherein a script will use LWP to get a copy of a remote website. I'd like to find the amount of time that it takes for the script to pull the full index page of the URL I am handing to it, so I can log the number and see how it varies throughout the day. I question whether or not my code is valid for finding the true elapse time. This code is just for testing and doesnt take into consideration, http errors:

#!/usr/bin/perl -w + use strict; + use LWP::UserAgent; use Sys::Hostname; my $agent = new LWP::UserAgent( timeout => 30 ); my $site = 'http://www.perlmonks.org/'; my $response = new HTTP::Request GET => $site; my $start = time(); my $page = $agent->request($response); my $end = time(); my $sum = $end - $start; print "\n$end - $start = $sum";

This doesnt break down into ms, however I'm not that concerned about precise timing for the moment. I would however, like to be able to confirm when the entire page is downloaded and then compare start and finish times. Are there any LWP builtins that provide elapsed time? Am I really just getting the response time for the initial GET of the index page but none of the images held within it?

Thank you for your input -c