in reply to Code for Perlmonks XML to RSS
I was just playing around with your++ script. It's very cool, but I have the following comments / suggestions:
The line:
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" . $response->content_type) 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.
Excellent work. I thoroughly enjoyed it. Also, not to nitpick, but why don't you put
use strict; use warnings;
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Code for Perlmonks XML to RSS
by xdg (Monsignor) on Mar 30, 2004 at 21:02 UTC |