]>
Dogcows Code - chaz/p5-Catalyst-Plugin-Sitemap/blob - lib/Catalyst/Plugin/Sitemap.pm
73639508f26c3c2b1fa3034011aa8b9861e4e0d2
1 package Catalyst
::Plugin
::Sitemap
;
8 no warnings qw
/uninitialized/;
11 use List
::Util qw
/ first /;
16 my $sitemap = Search
::Sitemap-
>new;
19 for my $controller ( $self->controller(qr//) ) {
21 for my $a ( $controller->get_action_methods ) {
23 my $action = $controller->action_for( $a->name );
25 my $attr = $action->attributes->{Sitemap
} or next ACTION
;
27 die "more than one attribute 'Sitemap' for sub ",
28 $a->fully_qualified_name
31 my @attr = split /\s*(?:,|=>)\s*/, $attr->[0];
36 if ( $attr[0] eq '*' ) {
37 my $sitemap_method = $action->name . "_sitemap";
39 if ( $controller->can($sitemap_method) ) {
40 $controller->$sitemap_method( $self, $sitemap );
45 if ( $attr[0] + 0 > 0 ) {
47 $uri_params{priority
} = $attr[0];
55 $uri_params{loc
} = $self->uri_for_action( $action->private_path );
57 $sitemap->add( \
%uri_params );
73 is Sitemap
( <yadah
> ) ? => use it as
is
74 else => has <action
>_sitemap
? => use it
75 else => use the uri directly
79 my ( $self, $c, $sitemap ) = @_;
85 my ( $self, $c, $sitemap ) = @_;
88 sub do_stuff
:Local
:Sitemap
{
This page took 0.037527 seconds and 4 git commands to generate.