X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FDispatcher.pm;h=cc40dc1f20a8c60309803472644c8b48cb945f5e;hp=f1ccb80c76575623ad79ea875a5658e1cc145080;hb=15e9b5ddb1d1368677b9dfd59ec5625d9b3459e1;hpb=9e81ba44fc01c668e27370aa3eb0d476316ba589 diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index f1ccb80..cc40dc1 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -372,8 +372,17 @@ sub register { return unless $reg + $priv; my $namespace = $action->namespace; - my $parent = $self->tree; - my $visitor = Tree::Simple::Visitor::FindByPath->new; + my $node = $self->find_or_create_namespace_node( $namespace ); + + # Set the method value + $node->getNodeValue->actions->{ $action->name } = $action; +} + +sub find_or_create_namespace_node { + my ( $self, $namespace, $parent, $visitor ) = @_; + + $parent ||= $self->tree; + $visitor ||= Tree::Simple::Visitor::FindByPath->new; if ($namespace) { for my $part ( split '/', $namespace ) { @@ -399,8 +408,7 @@ sub register { } } - # Set the method value - $parent->getNodeValue->actions->{ $action->name } = $action; + return $parent; } =head2 $self->setup_actions( $class, $context )