2 # User routing routines
4 # Copyright (c) 2001 Dirk Koopman G1TLH
17 use vars qw(%list %valid @ISA $max $filterdef);
20 $filterdef = $Route::filterdef;
26 my $n = scalar(keys %list);
27 $max = $n if $n > $max;
45 confess "already have $call in $pkg" if $list{$call};
47 my $self = $pkg->SUPER::new($call);
48 $self->{parent} = [ $ncall ];
49 $self->{flags} = $flags || Route::here(1);
50 $self->{ip} = $ip if defined $ip;
52 dbg("CLUSTER: user $call added") if isdbg('cluster');
66 my $call = $self->{call};
67 $self->delparent($pref);
68 unless (@{$self->{parent}}) {
70 dbg("CLUSTER: user $call deleted") if isdbg('cluster');
79 $call = shift if ref $call;
80 my $ref = $list{uc $call};
81 dbg("Failed to get User $call" ) if !$ref && isdbg('routerr');
88 return $self->_addlist('parent', @_);
94 return $self->_dellist('parent', @_);
100 # generic AUTOLOAD for accessors
106 my ($pkg,$name) = $AUTOLOAD =~ /^(.*)::(\w+)$/;
107 return if $name eq 'DESTROY';
109 confess "Non-existant field '$AUTOLOAD'" unless $valid{$name} || $Route::valid{$name};
111 # this clever line of code creates a subroutine which takes over from autoload
112 # from OO Perl - Conway
113 *$AUTOLOAD = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
115 # *{"${pkg}::$name"} = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
116 # goto &{"${pkg}::$name"};