Skip to content

Commit

Permalink
use same format for entry as for feed
Browse files Browse the repository at this point in the history
  • Loading branch information
fcuny committed Nov 27, 2010
1 parent 3bf894d commit b13da2b
Showing 1 changed file with 41 additions and 10 deletions.
51 changes: 41 additions & 10 deletions lib/Dancer/Plugin/Feed.pm
Expand Up @@ -29,7 +29,7 @@ register create_feed => sub {
$format = $settings->{format} or die "format is missing";
}

if ($format !~ /^(?:atom|rss)$/) {
if ($format !~ /^(?:atom|rss)$/i) {
die "unknown format";
}

Expand All @@ -54,7 +54,7 @@ sub _create_feed {
} @feed_properties;

foreach my $entry (@$entries) {
my $e = XML::Feed::Entry->new();
my $e = XML::Feed::Entry->new($format);

map {
my $val = $entry->{$_};
Expand All @@ -81,6 +81,10 @@ sub _create_rss_feed {

register_plugin;

=head1 NAME
Dancer::Plugin::Feed - easy to generate feed rss or atom for Dancer applications.
=head1 SYNOPSIS
use Dancer;
Expand All @@ -99,16 +103,9 @@ register_plugin;
dance;
=head1 NAME
Dancer::Plugin::Feed - easy to generate feed rss or atom for Dancer applications.
=head1 SYNOPSIS
=head1 DESCRIPTION
Provides an easy generate feed rss or atom
keyword within your L<Dancer> application.
Provides an easy generate feed rss or atom keyword within your L<Dancer> application. This module relies on L<XML::Feed>. Please, consult the documentation of L<XML::Feed> and L<XML::Feed::Entry>.
=head1 CONFIGURATION
Expand All @@ -133,6 +130,40 @@ keyword within your L<Dancer> application.
#The title, link, and description, are required for RSS 1.0. language is required for RSS 0.91. Version are required for all version. The other parameters are optional for RSS 0.91 and 1.0.
=head1 FUNCTIONS
=head2 create_feed
This function returns a XML feed. Accepted parameters are :
=over 4
=item format (required)
The B<Content-Type> header will be set to the appropriate value
=item title
=item base
=item link
=item tagline
=item description
=item author
=item language
=item copyright
=item self_link
=item modified
=back
=head1 AUTHOR
Natal Ngétal, C<< <hobbestigrou@erakis.im> >>
Expand Down

0 comments on commit b13da2b

Please sign in to comment.