This is soooo much better. It should last a lot longer
without maintenance as well.
use LWP;
use XML::Simple;
use HTTP::Request::Common;
use strict;
use constant URL => 'http://perlmonks.org/index.pl';
my $node = shift;
print "USAGE: $0 [node_id]\n" and exit unless $node;
my $ua = LWP::UserAgent->new;
$ua->agent('node_xml_grabber/1.0 (' . $ua->agent .')');
my $request = POST(URL, Content => [
node_id => $node,
displaytype => 'xml',
]);
my $response = $ua->request($request) or die "no download id $node";
my $content = $response->content();
my $xml = XMLin($content) or die "xml error!";
my $date = scalar localtime($xml->{ucreatetime}->{content});
print <<EOF;
$xml->{title}->{content} by [$xml->{author_user}->{content}]
on $date
$xml->{doctext}->{content}
EOF
Big thanks to
Kanji :)
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)