http://qs321.pair.com?node_id=128488
Category: Perlmonks Related Scripts
Author/Contact Info blakem .... uh, /msg blakem
Description: Displays a bargraph of *your* nodes per hour. Similiar to the previous one, but parses a different XML feed and shows data about all the nodes you have personally posted.

(telling observation: I have yet to post a node during the 9am-10am slot....)

#!/usr/bin/perl -wT
use strict;
use LWP::Simple;
use XML::Simple;
use Time::Local;
use Text::BarGraph;

my $xmlurl       = "http://perlmonks.org/index.pl?node_id=32704";
my $user         = 'blakem';
my $pass         = 'yeahright';

## Ask the perlmonks XML engine about my nodes
my $queryurl = $xmlurl . "&user=$user&passwd=$pass&op=login";
my $xml = get $queryurl;
$xml =~  tr [\200-\377] [\000-\177];  # kludge to zero out high-bit as
+cii
my $nodeinfo = XMLin($xml);

## Tally what hour they were posted in %nodecount
my %nodecount = map {$_=>0} ('00' .. '23');
for my $node (values %{$nodeinfo->{NODE}}) {
  my ($year,$mon,$mday,$hours,$min,$sec) = split(/\D+/,$node->{createt
+ime});
  $year -= 1900;
  $mon--;
  my $time = timegm($sec,$min,$hours,$mday,$mon,$year);
  my $hour = (localtime($time))[2];
  # print $node->{id} .": ". localtime($time) . " => $hour\n";
  $nodecount{sprintf("%02d",$hour)}++;
}

# print out a bargraph
my $g = Text::BarGraph->new();
$g->{num} = 1;
print $g->graph(\%nodecount);

=head1 OUTPUT ( blakems nodes by the hour they were posted )
 00 (43) ###################################################
 01 (39) ##############################################
 02 (26) ##############################
 03 (26) ##############################
 04 ( 7) ########
 05 (11) #############
 06 ( 4) ####
 07 ( 2) ##
 08 ( 1) #
 09 ( 0) 
 10 (30) ###################################
 11 (51) ############################################################
 12 (54) #############################################################
+###
 13 (35) #########################################
 14 (42) #################################################
 15 (58) #############################################################
+########
 16 (58) #############################################################
+########
 17 (41) ################################################
 18 (15) #################
 19 ( 4) ####
 20 (10) ###########
 21 (18) #####################
 22 (23) ###########################
 23 (30) ###################################