X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FController.pm;h=1d91b3ccf6b9d4df31eb05c0c28511e63e031a74;hb=d87210ecba82597fafd26a7da8c8e1bf66d2c5ec;hp=b6ca882aab90585eccc988622335613ede71199e;hpb=df960201c8d8c22edddedced4471c14606877145;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index b6ca882..1d91b3c 100644 --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@ -2,7 +2,7 @@ package Catalyst::Controller; use Moose; use Moose::Util qw/find_meta/; - +use List::MoreUtils qw/uniq/; use namespace::clean -except => 'meta'; BEGIN { extends qw/Catalyst::Component MooseX::MethodAttributes::Inheritable/; } @@ -29,9 +29,9 @@ has action_namespace => predicate => 'has_action_namespace', ); -has _controller_actions => +has actions => ( - is => 'rw', + accessor => '_controller_actions', isa => 'HashRef', init_arg => undef, ); @@ -200,7 +200,7 @@ sub get_action_methods { . ( ref $self ) ) } keys %{ $self->_controller_actions } ) if ( ref $self ); - return @methods; + return uniq @methods; } @@ -215,10 +215,13 @@ sub register_action_methods { #this is still not correct for some reason. my $namespace = $self->action_namespace($c); - # Uncomment as soon as you fix the tests :) - #if (!blessed($self) && $self eq $c && scalar(@methods)) { - # $c->log->warn("Action methods found defined in your application class, $self. This is deprecated, please move them into a Root controller."); - #} + # FIXME - fugly + if (!blessed($self) && $self eq $c && scalar(@methods)) { + my @really_bad_methods = grep { ! /^_(DISPATCH|BEGIN|AUTO|ACTION|END)$/ } map { $_->name } @methods; + if (scalar(@really_bad_methods)) { + $c->log->warn("Action methods (" . join(', ', @really_bad_methods) . ") found defined in your application class, $self. This is deprecated, please move them into a Root controller."); + } + } foreach my $method (@methods) { my $name = $method->name;