File Coverage

blib/lib/Dancer/Plugin/XML/RSS.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package Dancer::Plugin::XML::RSS;
2             {
3             $Dancer::Plugin::XML::RSS::VERSION = '0.02_01';
4             }
5             {
6             $Dancer::Plugin::XML::RSS::DIST = 'Dancer-Plugin-XML-RSS';
7             }
8              
9 1     1   21135 use Dancer ':syntax';
  1         250082  
  1         5  
10 1     1   1105 use Dancer::Plugin;
  1         1265  
  1         101  
11              
12 1     1   365 use XML::RSS;
  0            
  0            
13              
14             register 'rss' => sub {
15             my $option = shift; # 'new' force creation of new obj
16             my $settings = plugin_setting || {};
17              
18             debug( $settings );
19            
20             # need to lookup format for plugin setting and see if this will map to
21             # values correct in xml::rss object
22             var xml_rss_obj => (
23             ! vars->{xml_rss_obj} || ( defined $option && $option =~ /new/i ) ?
24             XML::RSS->new( %{ $settings } ) : vars->{xml_rss_obj} );
25              
26             return vars->{xml_rss_obj};
27             };
28              
29             register 'rss_output' => sub {
30             content_type('text/xml'); # or application/xml+rss?
31             return vars->{xml_rss_obj}->as_string;
32             };
33              
34             register_plugin;
35              
36             1;
37              
38             # ABSTRACT: Dancer plugin for using XML::RSS to parse or create RSS feeds
39              
40             __END__