NAME
SETI::WebStats - Gather SETI@home statistics from the SETI@home web server
SYNOPSIS
use SETI::WebStats;
my $seti = SETI::WebStats->new;
# get individual user statistics...
if ($seti->fetchUserStats('foo@bar.org')) {
print "My rank current rank is " . $seti->rank, "\n";
print "I have processed " . $seti->numResults . " units.";
}
my $cpuTime = $seti->cpuTime;
my $userInfo = $seti->userInfo;
for (keys(%$userInfo)) {
print $_, "->", $userInfo->{$_}, "\n";
}
# get group statistics...
if ($seti->fetchGroupStats('perlmonks')) {
print $seti->groupFounderName . " founded the group.\n";
print "We have " . $seti->numGroupMembers . "members.\n";
print "We've processed " . $seti->numGroupResults . " units.\n";
print "For a total group CPU time of " . $seti->totalGroupCPU;
}
ABSTRACT
A simple Perl interface to SETI@home User & Group statistics.
DESCRIPTION
The SETI::WebStats
module queries the SETI@home web server to retrieve user and group statistics via XML. The data availible from the server is the same as that displayed on the Individual User Statistics
and Group Statistics
web pages. In order to query the server, you will need a valid SETI@home account (i.e email address) or valid group name.
Using SETI::WebStats
Load the module as normal.
use SETI::WebStats
Create a WebStats object.
my $seti = SETI::WebStats->new;
Retrieving User Statistics
$seti->fetchUserStats('foo@bar.org');
The fetchUserStats
method takes a mandatory email address as it's only argument. The SETI@home web server will be queried and the XML output parsed. Returns 1 on success, 0 on failure.
You can then extract the user stats in one go:
my $userInfo = $seti->userInfo;
Returns a hash reference:
$userInfo = {
usertime => '3.530 years',
avecpu => '15 hr 54 min 36.3 sec',
numresults => '670',
regdate => 'Fri May 28 20:28:45 1999',
resultsperday => '0.51',
lastresulttime => 'Sat Jun 8 03:47:50 2002',
cputime => ' 1.217 years',
name => 'John Doe'};
Alternatively, instead of calling userInfo
, you can extract each user statistic individually:
my $userTime = $seti->userTime;
my $aveCpu = $seti->aveCpu;
my $procd = $seti->numResults;
my $registerDate = $seti->regDate;
my $dailyResults = $seti->resultsPerDay;
my $lastUnit = $seti->lastResultTime;
my $cpuTime = $seti->cpuTime;
my $accountName = $seti->name;
You can extract rank stats in one go:
my $rankInfo = $seti->rankInfo;
Returns a hash reference:
$rankInfo = {
num_samerank => '3',
ranktotalusers => '4152567',
top_rankpct => '0.516',
rank => '21410'};
Alternatively, instead of calling rankInfo
, you can extract each rank statistic individually:
my $usersWithSameRank = $seti->haveSameRank;
my $totalUsers = $seti->totalUsers;
my $percentComparedTo = $seti->rankPercent;
my $rank = $seti->rank;
Retrieving Group Statistics
$seti->fetchGroupStats('some_group_name');
The fetchGroupStats
method takes a mandatory group name as it's only argument. The SETI@home web server will be queried and the XML output parsed. Returns 1 on success, 0 on failure.
You can then extract each group statistic.
my $groupName = $seti->groupName;
my $groupURL = $seti->groupURL;
my $founder = $seti->groupFounderName;
my $founderURL = $seti->groupFounderURL;
my $groupResults = $seti->numGroupResults;
my $groupMembers = $seti->numGroupMembers;
my $groupCPU = $seti->totalGroupCPU;
BUGS
None that I'm aware of but be sure to let me know if you find one.
AUTHOR
Kevin Spencer <vek@perlmonk.org>