XML::RSS::Parser::Lite - A simple pure perl RSS parser.
use XML::RSS::Parser::Lite; use LWP::Simple; my $xml = get("http://url.to.rss"); my $rp = new XML::RSS::Parser::Lite; $rp->parse($xml); print $rp->get('title') . " " . $rp->get('url') . " " . $rp->get('description') . "\n"; for (my $i = 0; $i < $rp->count(); $i++) { my $it = $rp->get($i); print $it->get('title') . " " . $it->get('url') . " " . $it->get('description') . "\n"; # some RSSv2.0 optional parameters may have been set: if (defined $it->get('pubDate') { print "publication date found: " . $it->get('pubDate')."\n"; } }
XML::RSS::Parser::Lite is a simple pure perl RSS parser. It uses XML::Parser::Lite as backend.
For the fields available via get, please refer to the documentation: http://www.rss-specifications.com/rss-specifications.htm, for RSS v2.0: http://cyber.law.harvard.edu/rss/rss.html.
get
Creates a new RSS parser.
Parses the supplied xml.
Returns the number of items in the RSS file.
Integers sent to get returns and XML::RSS::Parser::Lite::Item while the strings title, url, and description returns these values from the RSS channel information.
On an XML::RSS::Parser::Lite::Item this can return the strings title, url, or description. All RSS v2.0 values are accessible, provided they are present in the feed: http://cyber.law.harvard.edu/rss/rss.html
Copyright (c) 2003-2013 Erik Bosrup. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Erik Bosrup, erik@bosrup.com ; Thomas Blanchard, thomasfp.blanchard@gmail.com
To install XML::RSS::Parser::Lite::Item, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::RSS::Parser::Lite::Item
CPAN shell
perl -MCPAN -e shell install XML::RSS::Parser::Lite::Item
For more information on module installation, please visit the detailed CPAN module installation guide.