use vars qw($VERSION $BRANCH);
$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0;
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
$main::build += $VERSION;
$main::branch += $BRANCH;
@ISA = qw(Route);
%valid = (
- parent => '0,Parent Calls,parray',
+ links => '0,Parent Calls,parray',
);
$filterdef = $Route::filterdef;
confess "already have $call in $pkg" if $list{$call};
my $self = $pkg->SUPER::new($call);
- $self->{parent} = [ $ncall ];
+ $self->{links} = [ $ncall ];
$self->{flags} = $flags;
$list{$call} = $self;
my $self = shift;
my $pref = shift;
$self->delparent($pref);
- unless (@{$self->{parent}}) {
+ unless (@{$self->{links}}) {
delete $list{$self->{call}};
return $self;
}
sub addparent
{
- my $self = shift;
- return $self->_addlist('parent', @_);
+ goto &Route::_addlink;
}
sub delparent
+{
+ goto &Route::_dellink;
+}
+
+sub parents
{
my $self = shift;
- return $self->_dellist('parent', @_);
+ return @{$self->{links}};
}
#
sub AUTOLOAD
{
no strict;
-
- my $self = shift;
- $name = $AUTOLOAD;
- return if $name =~ /::DESTROY$/;
- $name =~ s/.*:://o;
+ my ($pkg,$name) = $AUTOLOAD =~ /^(.*)::(\w+)$/;
+ return if $name eq 'DESTROY';
confess "Non-existant field '$AUTOLOAD'" unless $valid{$name} || $Route::valid{$name};
# this clever line of code creates a subroutine which takes over from autoload
# from OO Perl - Conway
-# *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ;
- @_ ? $self->{$name} = shift : $self->{$name} ;
+ *$AUTOLOAD = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
+ goto &$AUTOLOAD;
+# *{"${pkg}::$name"} = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}};
+# goto &{"${pkg}::$name"};
}
1;