2 # User routing routines
4 # Copyright (c) 2001 Dirk Koopman G1TLH
16 use vars qw($VERSION $BRANCH);
18 main::mkver($VERSION = q$Revision$);
20 use vars qw(%list %valid @ISA $max $filterdef);
24 parent => '0,Parent Calls,parray',
27 $filterdef = $Route::filterdef;
33 my $n = scalar(keys %list);
34 $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} = 0 || $flags;
69 $self->delparent($pref);
70 unless (@{$self->{parent}}) {
71 delete $list{$self->{call}};
80 $call = shift if ref $call;
81 my $ref = $list{uc $call};
82 dbg("Failed to get User $call" ) if !$ref && isdbg('routerr');
89 return $self->_addlist('parent', shift);
95 return $self->_dellist('parent', shift);
101 return $self->_haslist('parent', shift);
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"};