my $PI_URI = 'http://www.angio.net/pi/bigpi.cgi';
# Fill this in with the rep stats hash from parent node
my %REP_STATS = ( . . . );
my $total_rep;
while( my ($key, $value) = each %REP_STATS ) {
$total_rep += $key * $value;
}
my $saint_days = $total_rep / 40;
my $in_pi = do {
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
# Couldn't get proper param passing to work, so work-around
# by making the query string ourselves. Fix later.
#
my $response = $ua->get( $PI_URI . "?UsrQuery=$total_rep" );
local $_ = $response->content;
m!The string \Q$total_rep\E was found at position (\d+)!;
$1;
};
print "Total XP: $total_rep";
print "Saint Days: $saint_days";
print "In pi at: $in_pi";
####
Total XP: 4068710
Saint Days: 101717.75
In pi at: 3246447