App::Rssfilter::Match::BbcSports - match a BBC sport RSS item
version 0.07
use App::Rssfilter::Match::BbcSports; use Mojo::DOM; my $rss = Mojo::DOM->new( <<"End_of_RSS" ); <?xml version="1.0" encoding="UTF-8"?> <rss> <channel> <item> <guid>http://www.bbc.co.uk/sport/some_article</guid> <description>here is an article about a sporting event</description> </item> <item> <guid>http://www.bbc.co.uk/tech/new_rss_tool_changes_how_we_read_news</guid> <description>here is an article about an rss tool</description> </item> </channel> </rss> End_of_RSS print $_, "\n" for $rss->find( 'item' )->grep( \&App::Rssfilter::Match::BbcSports::match ); # or with an App::Rssfilter::Rule use App::Rssfilter::Rule; App::Rssfilter::Rule->new( condition => 'BbcSports', action => sub { print shift->to_xml, "\n" }, )->constrain( $rss ); # either way, prints # <item> # <guid>http://www.bbc.co.uk/tech/new_rss_tool_changes_how_we_read_news</guid> # <description>here is an article about an rss tool</description> # </item>
This module will match items from BBC RSS feeds which are about sporting events.
my $item_is_BBC_sport = App::Rssfilter::Match::BbcSports::match( $item );
Returns true if ther GUID of $item looks like a BBC sport GUID (like http://www.bbc.co.uk/sport).
$item
http://www.bbc.co.uk/sport
App::Rssfilter
App::Rssfilter::Rule
Daniel Holz <dgholz@gmail.com>
This software is copyright (c) 2013 by Daniel Holz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::Rssfilter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Rssfilter
CPAN shell
perl -MCPAN -e shell install App::Rssfilter
For more information on module installation, please visit the detailed CPAN module installation guide.