X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FRoute%2FNode.pm;h=4bb4c9ca4812624e43b6ed9170f7504c1d17c16a;hb=24656c96ca7d059dd24ac5a53a3ed55b164e756f;hp=6b4f4332de9a8ff163054d37b4733cb7d23879f6;hpb=101516b420ac77cd9eb8294651104e43f3461c06;p=spider.git diff --git a/perl/Route/Node.pm b/perl/Route/Node.pm index 6b4f4332..4bb4c9ca 100644 --- a/perl/Route/Node.pm +++ b/perl/Route/Node.pm @@ -56,14 +56,24 @@ sub max sub add { my $parent = shift; - my $call = uc shift; - confess "Route::add trying to add $call to myself" if $call eq $parent->{call}; - my $self = get($call); + 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; + 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; @@ -128,6 +138,9 @@ sub add_user { my $self = shift; my $ucall = shift; + + confess "Trying to add NULL User call to routing tables" unless $ucall; + $self->_adduser($ucall); $self->{usercount} = scalar @{$self->{users}};