I was just playing around with your++ script. It's very cool, but I have the following comments / suggestions:
die unless $response->is_success;
Really should be:
die ("Could not fetch the web page because: "
. $response->status_line) unless $response->is_success;
die ("Content type not text/xml. It was" .
unless ($response->content_type eq 'text/xml');
Otherwise you aren't notified why a get() fails, and it allows the user to try parsing a non XML web page -- which leads to some humorous results.
- Why is it even necessary to pass in the URL for the newest nodes page? Your script doesn't look like it will work on any page besides the newest nodes page, so doing a shift (@_) for the URL seems useless. Why not just set my $url = "http://www.perlmonks.org/index.pl?node_id=30175"; and be done with it?
Excellent work. I thoroughly enjoyed it. Also, not to nitpick, but why don't you put
at the top of your script? It runs with no problems under them, and it's good practice (plus I think it's a good idea to help any new monks seeing it to get in the habit of using them).
Good job again!
Want to support the EFF and FSF by buying cool stuff? Click here