X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FController.pm;h=1d91b3ccf6b9d4df31eb05c0c28511e63e031a74;hb=9563d3701ebb2e6a4ac4760ab84af6eb3ab7adc2;hp=cb01c11fd08c53dd1ee7139508afae148e671ac5;hpb=c77865585f68f34422f7a6eacf2fa901531f05d9;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index cb01c11..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/; } @@ -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;