Reputation: 1825
I need code in Perl for requesting and parsing ATOM and RSS feeds. Is there a CPAN module(s) for that?
Upvotes: 8
Views: 2110
Reputation: 132802
Almost any time that you ask "How can I do X in Perl?", the answer is to look at CPAN Search to find the module that does it.
To download from the web, the LWP family of modules can help you. To parse the documents, try something with Feed, RSS, or Atom in the name.
Four years later, though, I now recommend Mojolicious, which has its own user agent module and very strong support for DOM parsing and the various ways to pull out parts of a document. Depending on what you want, you probably don't need a special feed module anymore.
Upvotes: 16
Reputation: 140728
I've found that XML::Feed does a much better job of dealing with the errors that you are going to get if you're trying to parse arbitrary feeds that you don't control the generation of.
Upvotes: 0