Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/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) ###################################

In reply to Plot Your Nodes by Hour by blakem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-24 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found