App::Rssfilter::Filter::DeleteItem - remove an RSS item from its channel
version 0.07
use App::Rssfilter::Filter::MarkTitle; use Mojo::DOM; my $rss = Mojo::DOM->new( <<"End_of_RSS" ); <?xml version="1.0" encoding="UTF-8"?> <rss> <channel> <item><title>it's hi time</title><description>hi</description></item> <item><title>here we are again</title><description>hello</description></item> </channel> </rss> End_of_RSS $rss->find( 'item' )->each( sub { my $item = shift; if( $item =~ /hello/ ) { App::Rssfilter::Filter::DeleteItem::filter( $item ); } } ); # or with an App::Rssfilter::Rule use App::Rssfilter::Rule; App::Rssfilter::Rule->new( condition => sub { shift =~ m/hello/xms }, action => 'DeleteItem', )->constrain( $rss ); # either way print $rss->to_xml; # <?xml version="1.0" encoding="UTF-8"?> # <rss> # <channel> # <item><title>it's hi time</title>hi</item> # </channel> # </rss>
This module will remove an RSS item from its channel. Actually, it will remove any Mojo::DOM element from its parent. Use App::Rssfilter::Filter::MarkTitle for a non-destructive filter.
App::Rssfilter::Filter::DeleteItem::filter( $item, $matcher );
Removes $item from its parent and discards it.
$item
$matcher is an optional string specifying the condition which caused $item to be removed, and is ignored; it exists solely so that "constrain" in App::Rssfilter::Rule can set it to the name of the condition causing the match.
$matcher
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.