Lee Carmichael

NAME

Dancer::Plugin::XML::RSS - Dancer plugin for using XML::RSS to parse or create RSS feeds

VERSION

Version 0.01

SYNOPSIS

Allows access to XML::RSS object from inside of your Dancer application and default configuration of XML::RSS using the standard Dancer configuration file.

    package MyDancerApp;

    use Dancer 'syntax';
    use Dancer::Plugin::XML::RSS;

    # parse rss file and output
    get '/show_news' => {
      rss->parsefile( settings( 'news_feed' ) );

      # grab entries for template
      my @stories;
      my $display_max = settings('news_feed_display') || 5;

      for ( my $i = 0; $i <= $display_max; $i++ ) {
        next unless exists rss->{items}->[$i] 
          and ref rss->{items};

        push @stories, $item;
      }

      template 'news', { stories => \@stories };
    };

    get '/our_feed' => {
        rss->channel( 
            title => 'My Special Site',
            link  => 'mysite.example.org',
            description => 'A generic example for docs',
        );

        rss->add_item( 
        );

        rss_output;
    };

DESCRIPTION

Provides a simple way to parse RSS files by using XML::RSS. It will hold onto currently parsed feed or keyword 'rss' will return object instance for application use.

Using the 'rss_output' command it will first create correct content type and then serialize object into RSS XML for use in route.

CONFIGURATION

XML:RSS configuration parameters will be taken from your Dancer application config file. They should be specified as:

    plugins:
       'XML::RSS':
          output:  '0.9'  # output as rss v0.9

See XML::RSS for more detail on configuration options.

SUBROUTINES/METHODS

rss('new')

Creates and returns XML::RSS object. It will be setup with any XML::RSS options from configuration file.

After first call to rss existing XML::RSS object will be called to force a new object pass 'new' to rss

'new' - optional string to force creation of new rss object

rss_output

Converts XML::RSS object into xml with correct content type and body. Use for returning inside of route.

AUTHOR

Lee Carmichael, <lcarmich at cpan.org>

BUGS

Please report any bugs or feature requests to bug-dancer-plugin-xml-rss at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dancer-Plugin-XML-RSS. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Dancer::Plugin::XML::RSS

You can also look for information at:

TODO

  • Add configuration of output header with config file

  • Use configuration file to setup details of channel for rss output

LICENSE AND COPYRIGHT

Copyright 2011 Lee Carmichael.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

SEE ALSO

Dancer, XML::RSS, Dancer::Plugin, Dancer::Plugin::Feed




Hosting generously
sponsored by Bytemark