NAME

App::Rssfilter::Match::AbcPreviews - match an ABC preview RSS item

VERSION

version 0.07

SYNOPSIS

  use App::Rssfilter::Match::AbcPreviews;
  
  use Mojo::DOM;
  my $rss = Mojo::DOM->new( <<"End_of_RSS" );
<rss>
<channel>
  <item>
    <guid>http://www.abc.net.au/preview/some_article</guid>
    <description>here is an article which is in preview mode</description>
  </item>
  <item>
    <guid>http://www.abc.net.au/entertainment/new-preview-of-movie</guid>
    <description>here is an article about a preview of a movie</description>
  </item>
</channel>
</rss>
End_of_RSS

  print $_, "\n" for $rss->find( 'item' )->grep( \&App::Rssfilter::Match::AbcPreviews::match );

  # or with an App::Rssfilter::Rule

  use App::Rssfilter::Rule;
  App::Rssfilter::Rule->new(
      condition => 'AbcPreviews',
      action    => sub { print shift->to_xml, "\n" },
  )->constrain( $rss );

  # either way, prints

  # <item>
  #   <guid>http://www.abc.net.au/preview/some_article</guid>
  #   <description>here is an article which is in preview mode</description>
  # </item>

DESCRIPTION

This module will match an RSS item if its GUID contains 'preview', unless 'preview' is also in the title of the item. The Australian Broadcasting Corporation RSS feeds occasionally include items whose GUIDS contain 'preview' and link to non-existent pages, so this matcher was created to find them.

FUNCTIONS

match

my $item_is_preview = App::Rssfilter::Match::AbcPreviews::match( $item );

Returns true if $item contains 'preview' in its GUID and not in its title.

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.