2 # User routing routines
4 # Copyright (c) 2001 Dirk Koopman G1TLH
16 use vars qw(%list %valid @ISA $max $filterdef);
20 parent => '0,Parent Calls,parray',
23 $filterdef = $Route::filterdef;
29 my $n = scalar(keys %list);
30 $max = $n if $n > $max;
46 confess "already have $call in $pkg" if $list{$call};
48 my $self = $pkg->SUPER::new($call);
49 $self->{parent} = [ $ncall ];
50 $self->{flags} = $flags;
65 $self->delparent($pref);
66 unless (@{$self->{parent}}) {
67 delete $list{$self->{call}};
76 $call = shift if ref $call;
77 my $ref = $list{uc $call};
78 dbg("Failed to get User $call" ) if !$ref && isdbg('routerr');
85 return $self->_addlist('parent', @_);
91 return $self->_dellist('parent', @_);
95 # generic AUTOLOAD for accessors
101 my ($pkg,$name) = $AUTOLOAD =~ /^(.*)::(\w+)$/;
102 return if $name eq 'DESTROY';
104 confess "Non-existant field '$AUTOLOAD'" unless $valid{$name} || $Route::valid{$name};
106 # this clever line of code creates a subroutine which takes over from autoload
107 # from OO Perl - Conway
108 *$AUTOLOAD = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
110 # *{"${pkg}::$name"} = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
111 # goto &{"${pkg}::$name"};