From: Roland Lammel Date: Wed, 13 May 2009 18:25:30 +0000 (+0000) Subject: Rename the actions attribute in Catalyt::Controller to _controller_actions to avoid... X-Git-Tag: 5.80004~24 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=637be0867dd41db72c8be55d50c104e8d6694ab4;hp=6a8f85af6d0032d3f6aecc0ce9420ceb523910b2;p=catagits%2FCatalyst-Runtime.git Rename the actions attribute in Catalyt::Controller to _controller_actions to avoid name clashes with application controller naming. (random) --- diff --git a/Changes b/Changes index 3a02976..e0d7e21 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ # This file documents the revision history for Perl extension Catalyst. + - Rename the actions attribute in Catalyt::Controller to _controller_actions to + avoid name clashes with application controller naming. (random) - Test for using Moose in components which have a non-Moose base class Fixed by 349cda in Moose 0.78 (t0m) - Fix deprecation message for Catalyst::Dispatcher to refer diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 62fc85b..9a75306 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -2748,6 +2748,8 @@ phaylon: Robert Sedlacek rafl: Florian Ragwitz +random: Roland Lammel + sky: Arthur Bergman the_jester: Jesse Sheidlower diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index bf082ec..8b391df 100644 --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@ -29,7 +29,7 @@ has action_namespace => predicate => 'has_action_namespace', ); -has actions => +has _controller_actions => ( is => 'rw', isa => 'HashRef', @@ -41,7 +41,7 @@ sub BUILD { my $action = delete $args->{action} || {}; my $actions = delete $args->{actions} || {}; my $attr_value = $self->merge_config_hashes($actions, $action); - $self->actions($attr_value); + $self->_controller_actions($attr_value); } =head1 NAME @@ -260,7 +260,7 @@ sub _parse_attrs { # superior while mantaining really high degree of compat my $actions; if( ref($self) ) { - $actions = $self->actions; + $actions = $self->_controller_actions; } else { my $cfg = $self->config; $actions = $self->merge_config_hashes($cfg->{actions}, $cfg->{action}); diff --git a/t/lib/TestApp/Controller/Keyword.pm b/t/lib/TestApp/Controller/Keyword.pm new file mode 100644 index 0000000..6a7043b --- /dev/null +++ b/t/lib/TestApp/Controller/Keyword.pm @@ -0,0 +1,18 @@ +package TestApp::Controller::Keyword; + +use strict; +use base 'Catalyst::Controller'; + +# +# Due to 'actions' being used as an attribute up to cat 5.80003 using this name +# for an action causes a weird error, as this would be called during BUILD time +# of the Catalyst::Controller class +# + +sub actions : Local { + my ( $self, $c ) = @_; + die("Call to controller action method without context! Probably naming clash") unless $c; + $c->res->output("Test case for using 'actions' as a catalyst action name\n"); +} + +1;