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=f78ad166faaf27523a172ece5d9a26d74e539ec5;hp=961ce150aa64372982c786c5ffc3ce658c144881;hb=ffb820f8dcd7073ecb6a1ef8cf9b529be7784cd2;hpb=8505565b33db11c9c5059225b5fbb7cd7d79eb94 diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 961ce15..f78ad16 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -382,39 +382,32 @@ sub find_or_create_namespace_node { my ( $self, $namespace ) = @_; my $tree ||= $self->tree; - my $visitor ||= Tree::Simple::Visitor::FindByPath->new; - return $tree unless $namespace; my @namespace = split '/', $namespace; - return $self->_find_or_create_namespace_node( $tree, $visitor, @namespace ); + return $self->_find_or_create_namespace_node( $tree, @namespace ); } sub _find_or_create_namespace_node { - my ( $self, $parent, $visitor, $part, @namespace ) = @_; + my ( $self, $parent, $part, @namespace ) = @_; return $parent unless $part; - $visitor->setSearchPath($part); - $parent->accept($visitor); - my $child = $visitor->getResult; + my $child = ( grep { $_->getNodeValue->part eq $part } $parent->getAllChildren )[0]; unless ($child) { - # Create a new tree node and an ActionContainer to form # its value. my $container = Catalyst::ActionContainer->new( { part => $part, actions => {} } ); - $child = $parent->addChild( Tree::Simple->new($container) ); - $visitor->setSearchPath($part); - $parent->accept($visitor); - $child = $visitor->getResult; + + $parent->addChild( $child = Tree::Simple->new($container) ); } - $self->_find_or_create_namespace_node( $child, $visitor, @namespace ); + $self->_find_or_create_namespace_node( $child, @namespace ); } =head2 $self->setup_actions( $class, $context )