From: Yuval Kogman Date: Sat, 8 Apr 2006 19:09:04 +0000 (+0000) Subject: remove visitor from actioncontainer node creation stuff X-Git-Tag: 5.7099_04~643 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=ffb820f8dcd7073ecb6a1ef8cf9b529be7784cd2;hp=8505565b33db11c9c5059225b5fbb7cd7d79eb94 remove visitor from actioncontainer node creation stuff --- 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 )