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;
70 $self->delparent($pref);
71 unless (@{$self->{parent}}) {
72 delete $list{$self->{call}};
81 $call = shift if ref $call;
82 my $ref = $list{uc $call};
83 dbg("Failed to get User $call" ) if !$ref && isdbg('routerr');
90 return $self->_addlist('parent', @_);
96 return $self->_dellist('parent', @_);
102 # generic AUTOLOAD for accessors
108 my ($pkg,$name) = $AUTOLOAD =~ /^(.*)::(\w+)$/;
109 return if $name eq 'DESTROY';
111 confess "Non-existant field '$AUTOLOAD'" unless $valid{$name} || $Route::valid{$name};
113 # this clever line of code creates a subroutine which takes over from autoload
114 # from OO Perl - Conway
115 *$AUTOLOAD = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
117 # *{"${pkg}::$name"} = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
118 # goto &{"${pkg}::$name"};