[Catalyst-commits] r11335 - in Catalyst-Runtime/5.80/trunk:
lib/Catalyst t
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Mon Sep 7 20:25:54 GMT 2009
Author: t0m
Date: 2009-09-07 20:25:53 +0000 (Mon, 07 Sep 2009)
New Revision: 11335
Modified:
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
Catalyst-Runtime/5.80/trunk/t/unit_controller_actions.t
Log:
AGH. Too tired to be doing this, fucked it up again
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm 2009-09-07 20:21:52 UTC (rev 11334)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm 2009-09-07 20:25:53 UTC (rev 11335)
@@ -29,9 +29,9 @@
predicate => 'has_action_namespace',
);
-has _controller_actions =>
+has actions =>
(
- is => 'rw',
+ accessor => '_controller_actions',
isa => 'HashRef',
init_arg => undef,
);
@@ -187,23 +187,20 @@
. $meta->name
. " cannot support register_actions." )
unless $meta->can('get_nearest_methods_with_attributes');
+ my @methods = $meta->get_nearest_methods_with_attributes;
- # Find (and de-dup) action methods from attributes and those from config.
- my %methods = (
- map({ $_->name => 1 } $meta->get_nearest_methods_with_attributes),
- %{ $self->_controller_actions }
- );
-
- if (ref $self) {
- foreach (keys %methods) {
+ # actions specified via config are also action_methods
+ push(
+ @methods,
+ map {
$meta->find_method_by_name($_)
|| confess( 'Action "'
. $_
. '" is not available from controller '
- . ( ref $self ) );
- }
- }
- return keys %methods;
+ . ( ref $self ) )
+ } keys %{ $self->_controller_actions }
+ ) if ( ref $self );
+ return @methods;
}
Modified: Catalyst-Runtime/5.80/trunk/t/unit_controller_actions.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_controller_actions.t 2009-09-07 20:21:52 UTC (rev 11334)
+++ Catalyst-Runtime/5.80/trunk/t/unit_controller_actions.t 2009-09-07 20:25:53 UTC (rev 11335)
@@ -22,5 +22,5 @@
ok $controller->can('_controller_actions');
is_deeply $controller->_controller_actions => { foo => { Path => '/some/path' }};
is_deeply $controller->{actions} => { foo => { Path => '/some/path' }}; # Back compat.
-is_deeply [ sort grep { ! /^_/ } $controller->get_action_methods ], [sort qw/action foo/];
+is_deeply [ sort grep { ! /^_/ } map { $_->name } $controller->get_action_methods ], [sort qw/action foo/];
More information about the Catalyst-commits
mailing list