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 <{title}->{content} by [$xml->{author_user}->{content}] on $date $xml->{doctext}->{content} EOF