[Bast-commits] r8097 - in ironman/IronMan-Web/lib/IronMan: . Web/Controller

grim at dev.catalyst.perl.org grim at dev.catalyst.perl.org
Sat Dec 12 22:49:11 GMT 2009


Author: grim
Date: 2009-12-12 22:49:11 +0000 (Sat, 12 Dec 2009)
New Revision: 8097

Modified:
   ironman/IronMan-Web/lib/IronMan/Web.pm
   ironman/IronMan-Web/lib/IronMan/Web/Controller/Root.pm
Log:
Added OPML and fixed warnings from RSS Feed

Modified: ironman/IronMan-Web/lib/IronMan/Web/Controller/Root.pm
===================================================================
--- ironman/IronMan-Web/lib/IronMan/Web/Controller/Root.pm	2009-12-12 22:47:48 UTC (rev 8096)
+++ ironman/IronMan-Web/lib/IronMan/Web/Controller/Root.pm	2009-12-12 22:49:11 UTC (rev 8097)
@@ -5,6 +5,8 @@
 use Data::UUID;
 use IronMan::Feeds;
 use Email::Valid;
+use DateTime;
+use XML::OPML;
 use base 'Catalyst::Controller';
 
 #
@@ -91,6 +93,29 @@
     $c->stash(inserted => $fdb->id);
 }
 
+#Display OPML showing the feeds.
+sub opml : Local Args(0) {
+    my ( $self, $c ) = @_;
+
+    my $opml = new XML::OPML(version => "1.1");
+
+    $opml->head(
+        title => 'all.things.per.ly',
+        dateCreated => DateTime->now(),
+    ); 
+
+    $c->res->content_type('application/xml');
+
+    foreach my $feed ($c->model('FeedDB::Feed')->all) {
+        $opml->add_outline( 
+            'title'     => $feed->title,
+            'xmlUrl'    => $feed->url,
+        );
+    }
+
+    $c->res->body($opml->as_string);
+}
+
 =head2 end
 
 Attempt to render a view, if needed.
@@ -101,8 +126,8 @@
     my ( $self, $c ) = @_;
 
     $c->stash(current_view => 'RSS') if (
-        ($c->req->param('feed') eq 'RSS') || 
-        ($c->req->param('feed') eq 'atom')
+        ($c->req->param('feed') && $c->req->param('feed') eq 'RSS') || 
+        ($c->req->param('atom') && $c->req->param('feed') eq 'atom')
     );
 
 

Modified: ironman/IronMan-Web/lib/IronMan/Web.pm
===================================================================
--- ironman/IronMan-Web/lib/IronMan/Web.pm	2009-12-12 22:47:48 UTC (rev 8096)
+++ ironman/IronMan-Web/lib/IronMan/Web.pm	2009-12-12 22:49:11 UTC (rev 8097)
@@ -14,7 +14,7 @@
 # Static::Simple: will serve static files from the application's root 
 #                 directory
 
-use Catalyst qw/-Debug ConfigLoader Static::Simple/;
+use Catalyst qw/-Debug ConfigLoader Static::Simple StackTrace/;
 
 our $VERSION = '0.01';
 




More information about the Bast-commits mailing list