--- /dev/null
- 'dist_version' => '0.0.1',
+
+use strict;
+use warnings;
+
+use Module::Build 0.3601;
+
+
+my %module_build_args = (
+ 'build_requires' => {
+ 'Carp' => '0',
+ 'Catalyst' => '0',
+ 'Catalyst::Controller' => '0',
+ 'Catalyst::Test' => '0',
+ 'Module::Build' => '0.3601',
+ 'Scalar::Util' => '0',
+ 'Test::More' => '0.94',
+ 'parent' => '0',
+ 'perl' => '5.004'
+ },
+ 'configure_requires' => {
+ 'Module::Build' => '0.3601'
+ },
+ 'dist_abstract' => 'Sitemap support for Catalyst.',
+ 'dist_author' => [
+ 'Yanick Champoux <yanick@babyl.dyndns.org>'
+ ],
+ 'dist_name' => 'Catalyst-Plugin-Sitemap',
- 'Search::Sitemap' => '0'
++ 'dist_version' => '1.0.0',
+ 'license' => 'perl',
+ 'module_name' => 'Catalyst::Plugin::Sitemap',
+ 'recommends' => {},
+ 'recursive_test_files' => 1,
+ 'requires' => {
+ 'List::Util' => '0',
+ 'Moose::Role' => '0',
++ 'WWW::Sitemap::XML' => '0'
+ },
+ 'script_files' => []
+);
+
+
+my $build = Module::Build->new(%module_build_args);
+
+$build->create_build_script;
Revision history for Catalyst-Plugin-Sitemap
-{{$NEXT}}
-
+ 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
--- /dev/null
- "generated_by" : "Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.101590",
+{
+ "abstract" : "Sitemap support for Catalyst.",
+ "author" : [
+ "Yanick Champoux <yanick@babyl.dyndns.org>"
+ ],
+ "dynamic_config" : 0,
- "Search::Sitemap" : 0
++ "generated_by" : "Dist::Zilla version 4.102345, CPAN::Meta::Converter version 2.101590",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Catalyst-Plugin-Sitemap",
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "Module::Build" : "0.3601"
+ }
+ },
+ "configure" : {
+ "requires" : {
+ "Module::Build" : "0.3601"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "List::Util" : 0,
+ "Moose::Role" : 0,
- "version" : "v0.0.1"
++ "WWW::Sitemap::XML" : 0
+ }
+ },
+ "test" : {
+ "requires" : {
+ "Carp" : 0,
+ "Catalyst" : 0,
+ "Catalyst::Controller" : 0,
+ "Catalyst::Test" : 0,
+ "Scalar::Util" : 0,
+ "Test::More" : "0.94",
+ "parent" : 0,
+ "perl" : "5.004"
+ }
+ }
+ },
+ "provides" : {
+ "Catalyst::Plugin::Sitemap" : {
+ "file" : "lib/Catalyst/Plugin/Sitemap.pm",
- "version" : "0.0.1"
++ "version" : "v1.0.0"
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "mailto" : "bug-catalyst-plugin-sitemap at rt.cpan.org",
+ "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Plugin-Sitemap"
+ },
+ "homepage" : "http://search.cpan.org/dist/Catalyst-Plugin-Sitemap/",
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/yanick/Catalyst-Plugin-Sitemap.git",
+ "web" : "http://github.com/yanick/Catalyst-Plugin-Sitemap/tree"
+ }
+ },
++ "version" : "1.0.0"
+}
+
--- /dev/null
- generated_by: 'Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.101590'
+---
+abstract: 'Sitemap support for Catalyst.'
+author:
+ - 'Yanick Champoux <yanick@babyl.dyndns.org>'
+build_requires:
+ Carp: 0
+ Catalyst: 0
+ Catalyst::Controller: 0
+ Catalyst::Test: 0
+ Module::Build: 0.3601
+ Scalar::Util: 0
+ Test::More: 0.94
+ parent: 0
+ perl: 5.004
+configure_requires:
+ Module::Build: 0.3601
+dynamic_config: 0
- version: v0.0.1
++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
+ version: 1.4
+name: Catalyst-Plugin-Sitemap
+provides:
+ Catalyst::Plugin::Sitemap:
+ file: lib/Catalyst/Plugin/Sitemap.pm
- Search::Sitemap: 0
++ version: v1.0.0
+requires:
+ List::Util: 0
+ Moose::Role: 0
- version: 0.0.1
++ 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: 1.0.0
--- /dev/null
- SHA1 6e9257c1f0d56e7477a6c3dd0a89aa12da99ee34 Build.PL
- SHA1 6c29f09fb70d3a649beeeba49c327c508b8d3f21 Changes
+This file contains message digests of all files listed in MANIFEST,
+signed via the Module::Signature module, version 0.64.
+
+To verify the content in this distribution, first make sure you have
+Module::Signature installed, then type:
+
+ % cpansign -v
+
+It will check each file's integrity, as well as the signature's
+validity. If "==> Signature verified OK! <==" is not displayed,
+the distribution may already have been compromised, and you should
+not run its Makefile.PL or Build.PL.
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
- SHA1 39b94a4484567596f4e466bc82f30785018cd502 META.json
- SHA1 2376cd5a83bdb52d9400ece68d4d7c5d4c7376e7 META.yml
- SHA1 659d2f7059534127e8b98ce9b276fec2be7a02a8 lib/Catalyst/Plugin/Sitemap.pm
++SHA1 ec9d7233b92322084ff257368adcd37e8f392c4f Build.PL
++SHA1 a5008ab99697e794fd04d95f623e7862990bb888 Changes
+SHA1 3ee0d276167c367325eebe1d5ec9877ade504d93 LICENSE
+SHA1 27dbcf2e21d25049bc4486395d18d7550732f2d3 MANIFEST
- SHA1 f2cb7af81edd193cac613e42116d29215e4d2e58 t/lib/TestApp/Controller/Root.pm
- SHA1 a3bbccffc4212a277329be0055742310bfd4eebb t/sitemap.t
++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
- iEYEARECAAYFAkyj14cACgkQ34Hwf+GwC4zEfQCg9EWt7+v9hzOQnvTansbtqmUx
- xCAAn32842Ivd3MNl3ek05Jq239wv+Fg
- =ct87
++SHA1 7906b6e31e1e56c59cc970c66332f56cd41635ec t/lib/TestApp/Controller/Root.pm
++SHA1 67c7e4f0af7ea5454b0f33fb971675f2be5eb973 t/sitemap.t
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.10 (GNU/Linux)
+
++iEYEARECAAYFAkz1teUACgkQ34Hwf+GwC4yskQCdHR3zsy//6fNlszKwS+aF1NxO
++lnUAoOaZJ1iW9BZYtNPWsgr+/ALcUm5L
++=CqLE
+-----END PGP SIGNATURE-----
package Catalyst::Plugin::Sitemap;
- $Catalyst::Plugin::Sitemap::VERSION = '0.0.1';
+BEGIN {
++ $Catalyst::Plugin::Sitemap::VERSION = '1.0.0';
+}
+
# ABSTRACT: Sitemap support for Catalyst.
- use Search::Sitemap;
+
+use strict;
+use warnings;
+
+use Moose::Role;
+
+no warnings qw/uninitialized/;
+
- sub sitemap {
++use WWW::Sitemap::XML;
+use List::Util qw/ first /;
+
- my $sitemap = Search::Sitemap->new;
- $sitemap->pretty(1);
++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;
+
- for my $controller ( $self->controller(qr//) ) {
++ my $sitemap = WWW::Sitemap::XML->new;
+
- $sitemap->add( \%uri_params );
-
- next ACTION;
++ for my $controller ( map { $self->controller($_) } $self->controllers ) {
+ ACTION:
+ for my $a ( $controller->get_action_methods ) {
+
+ my $action = $controller->action_for( $a->name );
+
+ my $attr = $action->attributes->{Sitemap} or next ACTION;
+
+ die "more than one attribute 'Sitemap' for sub ",
+ $a->fully_qualified_name
+ if @$attr > 1;
+
+ my @attr = split /\s*(?:,|=>)\s*/, $attr->[0];
+
+ my %uri_params;
+
+ if ( @attr == 1 ) {
+ if ( $attr[0] eq '*' ) {
+ my $sitemap_method = $action->name . "_sitemap";
+
+ if ( $controller->can($sitemap_method) ) {
+ $controller->$sitemap_method( $self, $sitemap );
+ next ACTION;
+ }
+ }
+
+ if ( $attr[0] + 0 > 0 ) {
++
+ # it's a number
+ $uri_params{priority} = $attr[0];
+ }
+
+ }
+ elsif ( @attr > 0 ) {
+ %uri_params = @attr;
+ }
+
+ $uri_params{loc} = $self->uri_for_action( $action->private_path );
+
- version 0.0.1
++ $sitemap->add(%uri_params);
+ }
+
+ }
+
+ return $sitemap;
+}
+
+1;
+
+
+
+=pod
+
+=head1 NAME
+
+Catalyst::Plugin::Sitemap - Sitemap support for Catalyst.
+
+=head1 VERSION
+
++version 1.0.0
+
=head1 SYNOPSIS
# in MyApp.pm
=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
+=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
-=cut
-
-use strict;
-use warnings;
-
-use Moose::Role;
-
-no warnings qw/uninitialized/;
-
-use WWW::Sitemap::XML;
-use List::Util qw/ first /;
-
-has sitemap => (
- is => 'ro',
- builder => '_build_sitemap',
- lazy => 1,
-);
-
-sub sitemap_as_xml {
- my $self = shift;
- return $self->sitemap->as_xml->toString;
-}
+=head1 AUTHOR
- Yanick Champoux <yanick@babyl.dyndns.org>
-sub _build_sitemap {
- my $self = shift;
++Yanick Champoux <yanick@babyl.dyndns.org>
- my $sitemap = WWW::Sitemap::XML->new;
-
- for my $controller ( map { $self->controller($_) } $self->controllers ) {
- ACTION:
- for my $a ( $controller->get_action_methods ) {
+=head1 COPYRIGHT AND LICENSE
- my $action = $controller->action_for( $a->name );
+This software is copyright (c) 2010 by Yanick Champoux.
- my $attr = $action->attributes->{Sitemap} or next ACTION;
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
- die "more than one attribute 'Sitemap' for sub ",
- $a->fully_qualified_name
- if @$attr > 1;
-
- my @attr = split /\s*(?:,|=>)\s*/, $attr->[0];
-
- my %uri_params;
-
- if ( @attr == 1 ) {
- if ( $attr[0] eq '*' ) {
- my $sitemap_method = $action->name . "_sitemap";
-
- if ( $controller->can($sitemap_method) ) {
- $controller->$sitemap_method( $self, $sitemap );
- next ACTION;
- }
- }
-
- if ( $attr[0] + 0 > 0 ) {
-
- # it's a number
- $uri_params{priority} = $attr[0];
- }
-
- }
- elsif ( @attr > 0 ) {
- %uri_params = @attr;
- }
-
- $uri_params{loc} = $self->uri_for_action( $action->private_path );
-
- $sitemap->add(%uri_params);
- }
-
- }
-
- return $sitemap;
-}
+=cut
-1;
__END__