tags:

views:

527

answers:

4

I need code in Perl for requesting and parsing ATOM and RSS feeds. Is there a CPAN module(s) for that?

+6  A: 

XML::FeedPP is good ...

mjy
Beware of at least http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=libxml-feedpp-perl;dist=unstable but it's the best thats out there, AFAIK.
derobert
+8  A: 

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.

brian d foy
Brian, this isn't as helpful as you might hope in this case: searching for 'RSS' and a few other terms tends to get you writers, plugins for other tools and old, dead modules and any signal in there is drowned out by noise.
ijw
@ijw: spend more than 3 minutes trying.
brian d foy
+4  A: 

Both XML::RSS and XML::Atom exist. Be warned -- XML::Atom does not seem to be actively maintained and reportedly has bugs. But the basics should be enough to get you going.

To fetch the feeds LWP::Simple is a good choice.

XML::RSS is an RSS generator, not a reader.
ijw
XML::RSS is primarily used to generate RSS files but it also has `parse()` methods to read RSS.
krock
A: 

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.

genehack