PERL Help

SMN

SMN

Soldato
Joined
2 Nov 2008
Posts
2,502
Location
The ether
Hi All,
Anyone got skills with PERL? I'm trying to download a HTML file using PERL and the key thing is i need the transfer rate (Mbps/MBps) and the time taken to be displayed. I have the following which will print out the html page but does anyone have any input on how to get the speed/time to be output?

Also, i'm trying to do the same but for a file server, e.g. how long it takes to pull down a target file and the transfer speed.
Cheers all.
 
#!/usr/bin/perl

require HTTP::Request;
require LWP::UserAgent;

my $url = 'http://www.google.com';
my $request = HTTP::Request->new(GET => $url);
my $ua = LWP::UserAgent->new;
my $response = $ua->request($request);
$response->is_success or die $response->status_line;
my $content = $response->content;
print $content;
 
Firstly you're probably better off posting this in the programming section.

But assuming you know the size of the file, before you do the bit you have shown add a line that gets the current time, and another after your bit , then calculate the time difference, and divide the know file size by the time difference
 
Back
Top Bottom