Mojo::Feed - Mojo::DOM-based parsing of RSS & Atom feeds
use Mojo::Feed::Reader; use Mojo::Feed; my $feed = Mojo::Feed::Reader->new->parse("atom.xml"); print $feed->title, "\n", $feed->items->map('title')->join("\n"); $feed = Mojo::Feed->new( body => $string );
Mojo::Feed is an Object Oriented module for identifying, fetching and parsing RSS and Atom Feeds. It relies on Mojo::DOM for XML/HTML parsing. Date parsing is done with HTTP::Date.
Mojo::Feed represents the parsed RSS/Atom feed; you can construct it by setting an XML string as the body, or by using a Mojo::Feed::Reader object.
body
Mojo::Feed implements the following attributes.
The original decoded string of the feed.
The parsed feed as <Mojo::DOM> object.
The source of the feed; either a Mojo::Path or Mojo::URL object, or undef if the feed source was a string.
Returns the feed's title.
Description of the feed, filled from channel description (RSS), subtitle (Atom 1.0) or tagline (Atom 0.3)
Web page URL associated with the feed
Mojo::Collection of Mojo::Feed::Item objects representing feed news items
Optional feed description
Name from author, dc:creator or webMaster field
author
dc:creator
webMaster
Time in epoch seconds (may be filled with pubDate, dc:date, created, issued, updated or modified)
Mojo::Feed inherits all methods from Mojo::Base and implements the following new ones.
my $feed = Mojo::Feed->new; my $feed = Mojo::Feed->new( body => $string);
Construct a new Mojo::Feed object.
my $hash = $feed->to_hash; print $hash->{title};
Return a hash reference representing the feed.
Return a XML serialized text of the feed's Mojo::DOM node. Note that this can be different from the original XML text in the feed.
Returns true if the top-level element of the DOM is a valid RSS (0.9x, 1.0, 2.0) or Atom tag. Otherwise, returns false.
Detect type of feed - returns one of "RSS 1.0", "RSS 2.0", "Atom 0.3", "Atom 1.0" or "unknown"
Dotan Dimet
Mario Domgoergen
Some tests adapted from Feed::Find and XML:Feed, Feed auto-discovery adapted from Feed::Find.
Copyright (C) Dotan Dimet.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Dotan Dimet <dotan@corky.net>
To install Mojo::Feed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Feed
CPAN shell
perl -MCPAN -e shell install Mojo::Feed
For more information on module installation, please visit the detailed CPAN module installation guide.