Gossamer Forum
Home : General : Perl Programming :

A few questions on LWP and GET

Quote Reply
A few questions on LWP and GET
A few questions on LWP and GET - I put together this little script to show what I am talking about but it's not the actually script that will be using, the ideas are the same.

Now, if using the following script, how can I actually measure

#1 - The Size of the File or Page that the LWP module or GET command is actually retrieving

&

#2 - The actual time that it takes the server to get the file. I would like to be able to measure the speed in which the file or page is retrieved.

I am sure it's very easy but I can not find any reference to this anywhere.

Here is the example script -

############################

#!/usr/bin/perl

use strict;
use CGI;
use LWP::Simple;

my $in = new CGI;

# Either display the source code, the search form or do the search.

# We are searching, so get the query, escape it, and use LWP to search.
my $url = "$ENV{'QUERY_STRING'}";
my $results = get ($url);

print CGI->header;
print $results;

exit;

Any ideas?
Quote Reply
Re: A few questions on LWP and GET In reply to
Have you tried perl.com? I use this time program called Time::HiRes. Thats a good one, or you can use a benchmark. They both should have info at perl.com, and the HiRes modules should be there too. I think for the size, you can use this
Code:
$ua->request([$size])

------------------
-----------------
Lavon Russell
LookHard! Search
www.lh.yi.org
webmaster@lh.yi.org