'Yanick Champoux <yanick@babyl.dyndns.org>'
],
'dist_name' => 'Catalyst-Plugin-Sitemap',
- 'dist_version' => '0.0.1',
+ 'dist_version' => '1.0.0',
'license' => 'perl',
'module_name' => 'Catalyst::Plugin::Sitemap',
'recommends' => {},
'requires' => {
'List::Util' => '0',
'Moose::Role' => '0',
- 'Search::Sitemap' => '0'
+ 'WWW::Sitemap::XML' => '0'
},
'script_files' => []
);
Revision history for Catalyst-Plugin-Sitemap
+1.0.0 2010-11-30 21:41:34 America/Montreal
+ - Change sitemap object under the hood to WWW::Sitemap::XML.
+ - Add Dancer::Plugin::SiteMap in the 'SEE ALSO' section.
+
0.0.1 2010-09-29 20:19:12 America/Montreal
- original version unleashed on an unsuspecting world
"Yanick Champoux <yanick@babyl.dyndns.org>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.101590",
+ "generated_by" : "Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.101590",
"license" : [
"perl_5"
],
"requires" : {
"List::Util" : 0,
"Moose::Role" : 0,
- "Search::Sitemap" : 0
+ "WWW::Sitemap::XML" : 0
}
},
"test" : {
"provides" : {
"Catalyst::Plugin::Sitemap" : {
"file" : "lib/Catalyst/Plugin/Sitemap.pm",
- "version" : "v0.0.1"
+ "version" : "v1.0.0"
}
},
"release_status" : "stable",
"web" : "http://github.com/yanick/Catalyst-Plugin-Sitemap/tree"
}
},
- "version" : "0.0.1"
+ "version" : "1.0.0"
}
configure_requires:
Module::Build: 0.3601
dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.101590'
+generated_by: 'Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.101590'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
provides:
Catalyst::Plugin::Sitemap:
file: lib/Catalyst/Plugin/Sitemap.pm
- version: v0.0.1
+ version: v1.0.0
requires:
List::Util: 0
Moose::Role: 0
- Search::Sitemap: 0
+ WWW::Sitemap::XML: 0
resources:
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Plugin-Sitemap
homepage: http://search.cpan.org/dist/Catalyst-Plugin-Sitemap/
repository: git://github.com/yanick/Catalyst-Plugin-Sitemap.git
-version: 0.0.1
+version: 1.0.0
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 6e9257c1f0d56e7477a6c3dd0a89aa12da99ee34 Build.PL
-SHA1 6c29f09fb70d3a649beeeba49c327c508b8d3f21 Changes
+SHA1 ec9d7233b92322084ff257368adcd37e8f392c4f Build.PL
+SHA1 a5008ab99697e794fd04d95f623e7862990bb888 Changes
SHA1 3ee0d276167c367325eebe1d5ec9877ade504d93 LICENSE
SHA1 27dbcf2e21d25049bc4486395d18d7550732f2d3 MANIFEST
-SHA1 39b94a4484567596f4e466bc82f30785018cd502 META.json
-SHA1 2376cd5a83bdb52d9400ece68d4d7c5d4c7376e7 META.yml
-SHA1 659d2f7059534127e8b98ce9b276fec2be7a02a8 lib/Catalyst/Plugin/Sitemap.pm
+SHA1 abde2a3863a49bfec78410e7371c8196f4cef1ac META.json
+SHA1 7362ebdd1d8b2b1085bd8ead8ba7c574de7bc22b META.yml
+SHA1 9d90ff124e267a7a5f7968bad9197ea89d919fe4 lib/Catalyst/Plugin/Sitemap.pm
SHA1 050aa113e828a52db3c86065c0c0ed50198b7ce8 t/000-report-versions.t
SHA1 bcc4b2250ff00f7dfad036512681c9ee57b9cf5a t/lib/TestApp.pm
-SHA1 f2cb7af81edd193cac613e42116d29215e4d2e58 t/lib/TestApp/Controller/Root.pm
-SHA1 a3bbccffc4212a277329be0055742310bfd4eebb t/sitemap.t
+SHA1 7906b6e31e1e56c59cc970c66332f56cd41635ec t/lib/TestApp/Controller/Root.pm
+SHA1 67c7e4f0af7ea5454b0f33fb971675f2be5eb973 t/sitemap.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
-iEYEARECAAYFAkyj14cACgkQ34Hwf+GwC4zEfQCg9EWt7+v9hzOQnvTansbtqmUx
-xCAAn32842Ivd3MNl3ek05Jq239wv+Fg
-=ct87
+iEYEARECAAYFAkz1teUACgkQ34Hwf+GwC4yskQCdHR3zsy//6fNlszKwS+aF1NxO
+lnUAoOaZJ1iW9BZYtNPWsgr+/ALcUm5L
+=CqLE
-----END PGP SIGNATURE-----
package Catalyst::Plugin::Sitemap;
BEGIN {
- $Catalyst::Plugin::Sitemap::VERSION = '0.0.1';
+ $Catalyst::Plugin::Sitemap::VERSION = '1.0.0';
}
+
# ABSTRACT: Sitemap support for Catalyst.
no warnings qw/uninitialized/;
-use Search::Sitemap;
+use WWW::Sitemap::XML;
use List::Util qw/ first /;
-sub sitemap {
+has sitemap => (
+ is => 'ro',
+ builder => '_build_sitemap',
+ lazy => 1,
+);
+
+sub sitemap_as_xml {
+ my $self = shift;
+ return $self->sitemap->as_xml->toString;
+}
+
+sub _build_sitemap {
my $self = shift;
- my $sitemap = Search::Sitemap->new;
- $sitemap->pretty(1);
+ my $sitemap = WWW::Sitemap::XML->new;
- for my $controller ( $self->controller(qr//) ) {
+ for my $controller ( map { $self->controller($_) } $self->controllers ) {
ACTION:
for my $a ( $controller->get_action_methods ) {
}
if ( $attr[0] + 0 > 0 ) {
+
# it's a number
$uri_params{priority} = $attr[0];
}
$uri_params{loc} = $self->uri_for_action( $action->private_path );
- $sitemap->add( \%uri_params );
-
- next ACTION;
+ $sitemap->add(%uri_params);
}
}
=head1 VERSION
-version 0.0.1
+version 1.0.0
=head1 SYNOPSIS
sub sitemap : Path('/sitemap') {
my ( $self, $c ) = @_;
- $c->res->body( $c->sitemap->xml );
+ $c->res->body( $c->sitemap_as_xml );
}
=head1 DESCRIPTION
=head2 sitemap()
-Returns a L<Search::Sitemap> object. The sitemap object is populated by
+Returns a L<WWW::Sitemap::XML> object. The sitemap object is populated by
inspecting the controllers of the application for actions with the
sub attribute C<:Sitemap>.
+=head2 sitemap_as_xml()
+
+Returns the sitemap as a string containing its XML representation.
+
=head1 C<:Sitemap> Subroutine Attribute
The sitemap is populated by actions ear-marked with the <:Sitemap> sub
...
}
-Adds the url with the given entry attributes (as defined by C<Search::Sitemap>).
+Adds the url with the given entry attributes (as defined by
+L<WWW::Sitemap::XML::URL>).
If the action does not
resolves in a single url, this will results in an error.
=back
-=head1 BUGS AND LIMITATIONS
-
-Currently, each invocation of the method C<sitemap()> will
-re-generate the C<Search::Sitemap> object. A future version
-of this module might offer a way to only compute the sitemap
-once.
-
=head1 SEE ALSO
=over
+=item L<WWW::Sitemap::XML>
+
+Module that C<Catalyst::Plugin::Sitemap> currently uses under the hood.
+
=item L<Search::Sitemap>
+Original module that this plugin was using under the hood.
+
+=item L<Dancer::Plugin::SiteMap>
+
+Similar plugin for the L<Dancer> framework, which inspired
+C<Catalyst::Plugin::Sitemap>.
+
=item http://babyl.dyndns.org/techblog/entry/catalyst-plugin-sitemap
+Blog article introducing C<Catalyst::Plugin::Sitemap>.
+
=back
=head1 AUTHOR
- Yanick Champoux <yanick@babyl.dyndns.org>
+Yanick Champoux <yanick@babyl.dyndns.org>
=head1 COPYRIGHT AND LICENSE
sub sitemap : Path('/sitemap') {
my ( $self, $c ) = @_;
+ $c->res->body( $c->sitemap_as_xml );
+}
+
+sub dynamic :Path('/dynamic') {
+ my ( $self, $c ) = @_;
+
+ $c->sitemap->add( "http://localhost/sumfin" ); #''.$c->uri_for( '/sumfin' ) );
- $c->res->body( $c->sitemap->xml );
+ $c->res->body( 'dynamic it is' );
}
sub alone :Local :Sitemap { }
use Test::More tests => 4; # last test to print
use lib 't/lib';
-
use Catalyst::Test 'TestApp';
-my $xml = request('/sitemap')->content;
+my $xml = get('/sitemap');
-diag $xml;
+note $xml;
$xml =~ s/\s+//g;