#!/usr/bin/perl
#########################################################################
#                                                                       #
#  This version of BBSpeed Logger Copyright (c)2006 Future Publishing   #
#                                                                       #
#  Based on BBSpeed Logger by Paul Grosse (c)2006.                      #
#                                                                       #
#########################################################################

use warnings;
# move to the right place
chdir "/home/userid/bin/perl/bbspeed";
# assemble string
$r = 'wget -o /home/userid/bin/perl/bbspeed/wgl http://your.isp.com/yourdirectory/';
$s = 'speedtestfilename.html?';
$s .= time;
$s .= "200";
$r .= $s;
$d = "rm $s";
# feed it to the computer so that the data we are after is stored in the log file called wgl
@wg = readpipe ($r);
#wait a bit
sleep 2;
# delete the file - we don't want hundreds of them clogging up the place
@wg = readpipe ($d);
#open and slurp the wget log file
open(LF, "</home/userid/bin/perl/bbspeed/wgl");
  @wg = <LF>;
close(LF);
# we are only really interested with the line containing the average speed so look only at that
$a = $wg[$#wg-1];
chomp $a;
# save that in this program's log file
open (LOG, ">>/home/userid/bin/perl/bbspeed/bbspeed_log");
  print LOG "$a\n";
close (LOG);
# that's all that there is to it.