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',
24 $filterdef = $Route::filterdef;
30 my $n = scalar(keys %list);
31 $max = $n if $n > $max;
47 confess "already have $call in $pkg" if $list{$call};
49 my $self = $pkg->SUPER::new($call);
50 $self->{parent} = [ $ncall ];
51 $self->{flags} = $flags || Route::here(1);
66 $self->delparent($pref);
67 unless (@{$self->{parent}}) {
68 delete $list{$self->{call}};
77 $call = shift if ref $call;
78 my $ref = $list{uc $call};
79 dbg("Failed to get User $call" ) if !$ref && isdbg('routerr');
86 return $self->_addlist('parent', @_);
92 return $self->_dellist('parent', @_);
96 # generic AUTOLOAD for accessors
102 my ($pkg,$name) = $AUTOLOAD =~ /^(.*)::(\w+)$/;
103 return if $name eq 'DESTROY';
105 confess "Non-existant field '$AUTOLOAD'" unless $valid{$name} || $Route::valid{$name};
107 # this clever line of code creates a subroutine which takes over from autoload
108 # from OO Perl - Conway
109 *$AUTOLOAD = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
111 # *{"${pkg}::$name"} = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
112 # goto &{"${pkg}::$name"};