From: Sebastian Riedel Date: Sun, 13 Nov 2005 02:43:44 +0000 (+0000) Subject: Fixed public accessible internal actions X-Git-Tag: 5.7099_04~933 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=7101bd1f9d86faa21526f6601dbdb401c679501c Fixed public accessible internal actions --- diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index acd1b59..35f129f 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -17,7 +17,7 @@ use overload '""' => sub { return ref shift }, fallback => 1; __PACKAGE__->mk_accessors( qw/tree dispatch_types registered_dispatch_types - method_action_class action_container_class/ + method_action_class action_container_class reserved_actions/ ); # Preload these action types @@ -26,6 +26,9 @@ our @PRELOAD = qw/Path Regex/; # Postload these action types our @POSTLOAD = qw/Index Default/; +# Reserved action names +our @RESERVED = qw/begin auto default index end/; + =head1 NAME Catalyst::Dispatcher - The Catalyst Dispatcher @@ -300,10 +303,18 @@ sub register { } } + # Check if action name is reserved + my $reserved = 0; + for my $name ( @{ $self->reserved_actions } ) { + $reserved++ if $action->name eq $name; + } + # Pass the action to our dispatch types so they can register it if reqd. - my $reg = 0; - foreach my $type ( @{ $self->dispatch_types } ) { - $reg++ if $type->register( $c, $action ); + my $reg = $reserved; + unless ($reserved) { + foreach my $type ( @{ $self->dispatch_types } ) { + $reg++ if $type->register( $c, $action ); + } } return unless $reg + $priv; @@ -349,6 +360,7 @@ sub setup_actions { $self->dispatch_types( [] ); $self->registered_dispatch_types( {} ); + $self->reserved_actions( \@RESERVED ); $self->method_action_class('Catalyst::Action'); $self->action_container_class('Catalyst::ActionContainer');