The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::Rssfilter::Match::BbcSports - match a BBC sport RSS item

VERSION

version 0.07

SYNOPSIS

    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>

DESCRIPTION

This module will match items from BBC RSS feeds which are about sporting events.

FUNCTIONS

match

    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).

SEE ALSO

AUTHOR

Daniel Holz <dgholz@gmail.com>

COPYRIGHT AND LICENSE

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.