App-Rssfilter
view release on metacpan or search on metacpan
lib/App/Rssfilter/Match/BbcSports.pm view on Meta::CPAN
=head1 DESCRIPTION
This module will match items from BBC RSS feeds which are about sporting events.
=head1 FUNCTIONS
=head2 match
my $item_is_BBC_sport = App::Rssfilter::Match::BbcSports::match( $item );
Returns true if ther GUID of C<$item> looks like a BBC sport GUID (like C<http://www.bbc.co.uk/sport>).
=head1 SEE ALSO
=over 4
=item *
L<App::Rssfilter>
=item *
t/app/rssfilter/rule.t view on Meta::CPAN
'Test::Match',
'condition_name defaults to condition attr (if a string)'
);
my $string_opt_rss = Mojo::DOM->new( $rss );
my $count = $string_opt_rule->constrain( $string_opt_rss );
is(
$string_opt_rss->find( 'item' )->first->description->text,
'hi hello WAS_FILTERED me please',
'looks up match & filter when namespace passed as string'
);
is(
$count,
1,
'constrain returns the number of items the rule was applied to'
);
};
subtest 'passing match & filter as strings with additional arguments', sub {
t/app/rssfilter/rule.t view on Meta::CPAN
<pubdate></pubdate>
<guid>http://example.org/test/4</guid>
</item>
END_OF_ITEM
my $count = $oo_rule->constrain( $oo_rss );
is(
$oo_rss->find( 'item' )->[1]->description->text,
'bad cop on the beat',
'looks up match & filter when OO module passed as string, and pass addition args to the ctors'
);
};
subtest 'passing match and filter as OO instances', sub {
my $oo_rule = App::Rssfilter::Rule->new(
condition => Test::Match::OO->new('just this'),
action => Test::Filter::OO->new("good cop" => "bad cop" ),
);
is(
( run in 0.716 second using v1.01-cache-2.11-cpan-39bf76dae61 )