NAME
XML::RSS::Aggregate - RSS Aggregator
SYNOPSIS
my $rss = XML::RSS::Aggregate->new(
# parameters for XML::RSS->channel()
title => 'Aggregated Examples',
link => 'http://blog.elixus.org/',
# parameters for XML::RSS::Aggregate->aggregate()
sources => [ qw(
http://one.example.com/index.rdf
http://another.example.com/index.rdf
http://etc.example.com/index.rdf
) ],
sort_by => sub {
$_[0]->{dc}{subject} # default to sort by dc:date
},
uniq_by => sub {
$_[0]->{title} # default to uniq by link
}
);
$rss->aggregate( sources => [ ... ] ); # more items
$rss->save("all.rdf");
DESCRIPTION
This module implements a subclass of XML::RSS, adding a single aggregate
method that fetches other RSS feeds and add to the object itself. It handles the proper ordering and duplication removal for aggregated links.
Also, the constructor new
is modified to take arguments to pass implicitly to channel
and aggregate
methods.
All the base methods are still applicable to this module; please see XML::RSS for details.
METHODS
- aggregate (sources=>\@url, sort_by=>\&func, uniq_by=>\&func)
-
This method fetches all RSS feeds listed in
@url
and pass their items to the object'sadd_item
.The optional
sort_by
argument specifies the function to use for ordering RSS items; it defaults to sort them by their{dc}{date}
attribute (converted to absolute timestamps), with ties broken by their{link}
attribute.The optional
uniq_by
argument specifies the function to use for removing duplicate RSS items; it defaults to remove items that has the same{link}
value.
SEE ALSO
AUTHORS
Autrijus Tang <autrijus@autrijus.org>
COPYRIGHT
Copyright 2002 by Autrijus Tang <autrijus@autrijus.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.