From 0c20c738b4de2a58b62ca68a6ffa67c5dfb35186 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alex=20J=2E=20G=2E=20Burzy=C5=84ski?= Date: Wed, 24 Nov 2010 12:00:09 +0000 Subject: [PATCH] Drop dependency on Search::Sitemap in favour of WWW::Sitemap::XML --- lib/Catalyst/Plugin/Sitemap.pm | 16 ++++++++-------- t/lib/TestApp/Controller/Root.pm | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/Catalyst/Plugin/Sitemap.pm b/lib/Catalyst/Plugin/Sitemap.pm index 3cadf65..c88be0f 100644 --- a/lib/Catalyst/Plugin/Sitemap.pm +++ b/lib/Catalyst/Plugin/Sitemap.pm @@ -35,7 +35,7 @@ package Catalyst::Plugin::Sitemap; sub sitemap : Path('/sitemap') { my ( $self, $c ) = @_; - $c->res->body( $c->sitemap->xml ); + $c->res->body( $c->sitemap->as_xml->sprint ); } =head1 DESCRIPTION @@ -47,7 +47,7 @@ of the sitemap of a Catalyst application. =head2 sitemap() -Returns a L object. The sitemap object is populated by +Returns a L object. The sitemap object is populated by inspecting the controllers of the application for actions with the sub attribute C<:Sitemap>. @@ -89,7 +89,8 @@ resolves in a single url, this will results in an error. ... } -Adds the url with the given entry attributes (as defined by C). +Adds the url with the given entry attributes (as defined by +L). If the action does not resolves in a single url, this will results in an error. @@ -116,7 +117,7 @@ resolving to many urls. =head1 BUGS AND LIMITATIONS Currently, each invocation of the method C will -re-generate the C object. A future version +re-generate the C object. A future version of this module might offer a way to only compute the sitemap once. @@ -125,7 +126,7 @@ once. =over -=item L +=item L =item http://babyl.dyndns.org/techblog/entry/catalyst-plugin-sitemap @@ -140,14 +141,13 @@ use Moose::Role; no warnings qw/uninitialized/; -use Search::Sitemap; +use WWW::Sitemap::XML; use List::Util qw/ first /; sub sitemap { my $self = shift; - my $sitemap = Search::Sitemap->new; - $sitemap->pretty(1); + my $sitemap = WWW::Sitemap::XML->new; for my $controller ( $self->controller(qr//) ) { ACTION: diff --git a/t/lib/TestApp/Controller/Root.pm b/t/lib/TestApp/Controller/Root.pm index 0eb3c6e..4852ee1 100644 --- a/t/lib/TestApp/Controller/Root.pm +++ b/t/lib/TestApp/Controller/Root.pm @@ -8,7 +8,7 @@ use parent 'Catalyst::Controller'; sub sitemap : Path('/sitemap') { my ( $self, $c ) = @_; - $c->res->body( $c->sitemap->xml ); + $c->res->body( $c->sitemap->as_xml->sprint ); } sub alone :Local :Sitemap { } -- 2.43.0