X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FRoute%2FNode.pm;h=e29fe3caefb1eeb393dd1322ff21f99ee3428888;hb=3e075e9d00d74fd477c44db2b29eb3eac9d6d88a;hp=4bb4c9ca4812624e43b6ed9170f7504c1d17c16a;hpb=eca912fbdcba8f6ee91f757aac3bf95f4d6bafab;p=spider.git diff --git a/perl/Route/Node.pm b/perl/Route/Node.pm index 4bb4c9ca..e29fe3ca 100644 --- a/perl/Route/Node.pm +++ b/perl/Route/Node.pm @@ -56,24 +56,14 @@ sub max sub add { my $parent = shift; - my $call = shift; - my $self; - - if (ref $call) { - $self = $call; - $call = $self->{call}; - } else { - $self = get($call); - } - - confess "Trying to add NULL Node call to routing tables" unless $call; - + my $call = uc shift; + confess "Route::add trying to add $call to myself" if $call eq $parent->{call}; + my $self = get($call); if ($self) { $self->_addparent($parent->{call}); $parent->_addnode($call); return undef; } - confess "Route::Node::add trying to add $call to myself" if $call eq $parent->{call}; $parent->_addnode($call); $self = $parent->new($call, @_); return $self; @@ -145,7 +135,12 @@ sub add_user $self->{usercount} = scalar @{$self->{users}}; my $uref = Route::User::get($ucall); - my @out = (Route::User->new($ucall, $self->{call}, @_)) unless $uref; + my @out; + if ($uref) { + $uref->addparent($self->{call}); + } else { + @out = Route::User->new($ucall, $self->{call}, @_); + } return @out; }