File Coverage

blib/lib/Text/Microformat/Plugin/Parser/RSS.pm
Criterion Covered Total %
statement 12 17 70.5
branch 1 2 50.0
condition 2 6 33.3
subroutine 4 4 100.0
pod 0 1 0.0
total 19 30 63.3


line stmt bran cond sub pod time code
1             package Text::Microformat::Plugin::Parser::RSS;
2 4     4   4978 use strict;
  4         10  
  4         216  
3 4     4   37 use warnings;
  4         9  
  4         206  
4 4     4   23 use HTML::TreeBuilder;
  4         7  
  4         23  
5              
6             # This plugin parses entity-encoded and CDATA 'description' elements from RSS,
7             # and inserts them into the tree.
8             sub parse {
9 20     20 0 2799 my $c = shift;
10 20         158 $c->NEXT::parse(@_); # wait until the XML parser has run
11 20 50 33     3462 if ($c->tree and $c->opts->{content_type} =~ /xml/i and $c->tree->root->tag eq 'rss') {
      33        
12 0           foreach my $e ($c->tree->look_down(_tag => $c->tag_regex('description'))) {
13 0           my $subtree = $c->html_to_tree($e->as_trimmed_text);
14 0           $e->delete_content;
15 0           $e->push_content($subtree->root->clone);
16 0           $subtree->delete;
17             }
18             }
19             }
20              
21             =head1 NAME
22              
23             Text::Microformat::Plugin::Parser::RSS - RSS parser plugin for Text::Microformat
24              
25             =head1 SEE ALSO
26              
27             L
28              
29             =head1 AUTHOR
30              
31             Keith Grennan, C<< >>
32              
33             =head1 BUGS
34              
35             Log bugs and feature requests here: L
36              
37             =head1 SUPPORT
38              
39             Project homepage: L
40              
41             =head1 COPYRIGHT & LICENSE
42              
43             Copyright 2007 Keith Grennan, all rights reserved.
44              
45             This program is free software; you can redistribute it and/or modify it
46             under the same terms as Perl itself.
47              
48             =cut
49              
50             1;