2 # User routing routines
4 # Copyright (c) 2001 Dirk Koopman G1TLH
17 use vars qw(%list %valid @ISA $max $filterdef);
21 parent => '0,Parent Calls,parray',
25 $filterdef = $Route::filterdef;
31 my $n = scalar(keys %list);
32 $max = $n if $n > $max;
50 confess "already have $call in $pkg" if $list{$call};
52 my $self = $pkg->SUPER::new($call);
53 $self->{parent} = [ $ncall ];
54 $self->{flags} = $flags || Route::here(1);
55 $self->{ip} = $ip if defined $ip;
57 dbg("CLUSTER: user $call added") if isdbg('cluster');
71 my $call = $self->{call};
72 $self->delparent($pref);
73 unless (@{$self->{parent}}) {
75 dbg("CLUSTER: user $call deleted") if isdbg('cluster');
84 $call = shift if ref $call;
85 my $ref = $list{uc $call};
86 dbg("Failed to get User $call" ) if !$ref && isdbg('routerr');
93 return $self->_addlist('parent', @_);
99 return $self->_dellist('parent', @_);
105 # generic AUTOLOAD for accessors
111 my ($pkg,$name) = $AUTOLOAD =~ /^(.*)::(\w+)$/;
112 return if $name eq 'DESTROY';
114 confess "Non-existant field '$AUTOLOAD'" unless $valid{$name} || $Route::valid{$name};
116 # this clever line of code creates a subroutine which takes over from autoload
117 # from OO Perl - Conway
118 *$AUTOLOAD = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
120 # *{"${pkg}::$name"} = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
121 # goto &{"${pkg}::$name"};