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;
# delete parent from this call's parent list
my $pcall = $pref->{call};
+ my $ncall = $self->{call};
+ $pref->_delnode($ncall);;
my $ref = $self->_delparent($pcall);
my @nodes;
# is this the last connection, I have no parents anymore?
unless (@$ref) {
- my $ncall = $self->{call};
foreach my $rcall (@{$self->{nodes}}) {
next if grep $rcall eq $_, @_;
my $r = Route::Node::get($rcall);
{
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}};
my $call = shift;
$call = shift if ref $call;
my $ref = $list{uc $call};
- dbg('routerr', "Failed to get Node $call" ) unless $ref;
+ dbg("Failed to get Node $call" ) if !$ref && isdbg('routerr');
return $ref;
}
my $pkg = ref $self;
my $call = $self->{call} || "Unknown";
- dbg('route', "destroying $pkg with $call");
+ dbg("destroying $pkg with $call") if isdbg('routelow');
}
#