From: Hans Dieter Pearcey Date: Tue, 7 Apr 2009 20:31:51 +0000 (+0000) Subject: split out methods to show rafl what I mean X-Git-Tag: 5.80001~40^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=9ab7d83d1c7106860b01e3c17c334a2794d9bd0a split out methods to show rafl what I mean --- diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index a080f84..f98a8d5 100644 --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@ -174,16 +174,26 @@ around path_prefix => sub { return $namespace; }; +sub get_action_methods { + my $self = shift; + my $meta = find_meta($self); + confess("Metaclass for " . ref($meta) ." for " . $meta->name + . " cannot support register_actions.") + unless $meta->can('get_all_methods_with_attributes'); + my @methods = $meta->get_all_methods_with_attributes; + return @methods; +} sub register_actions { my ( $self, $c ) = @_; + $self->register_action_methods( $c, $self->get_action_methods ); +} + +sub register_action_methods { + my ( $self, $c, @methods ) = @_; my $class = ref $self || $self; #this is still not correct for some reason. my $namespace = $self->action_namespace($c); - my $meta = find_meta($self); - confess("Metaclass for " . ref($meta) ." for " . $meta->name - . " cannot support register_actions.") - unless $meta->can('get_all_methods_with_attributes'); my @methods = $meta->get_all_methods_with_attributes; foreach my $method (@methods) {