From: minima Date: Thu, 16 Jan 2003 03:54:06 +0000 (+0000) Subject: 1. tidy up AUTOLOAD X-Git-Tag: PRE-1-52~91 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=7b616aeabce92e3cb416a5fe6640a288adfe5410;p=spider.git 1. tidy up AUTOLOAD 2. make sure empty PC16s are not sent out on startup --- diff --git a/Changes b/Changes index 1c057be0..c26b5708 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +14Jan03======================================================================= +1. Tidy up AUTOLOAD functions +2. Make sure that empty PC16s are not sent on startup to a node. 12Jan03======================================================================= 1. add Czech language courtesy of Milan OK1XH 06Jan03======================================================================= diff --git a/perl/Bands.pm b/perl/Bands.pm index 65849c9a..728bb615 100644 --- a/perl/Bands.pm +++ b/perl/Bands.pm @@ -141,7 +141,6 @@ sub field_prompt sub AUTOLOAD { no strict; - my $self = shift; my $name = $AUTOLOAD; return if $name =~ /::DESTROY$/; $name =~ s/^.*:://o; @@ -149,9 +148,7 @@ sub AUTOLOAD # 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}}; - &$AUTOLOAD($self, @_); -# *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ; -# @_ ? $self->{$name} = shift : $self->{$name} ; + goto &$AUTOLOAD; } 1; diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index aae692ef..9ef0cec2 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -626,7 +626,6 @@ sub broadcast_list #no strict; sub AUTOLOAD { - my $self = shift; no strict; my $name = $AUTOLOAD; return if $name =~ /::DESTROY$/; @@ -637,9 +636,7 @@ sub AUTOLOAD # 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}}; - &$AUTOLOAD($self, @_); -# *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ; -# @_ ? $self->{$name} = shift : $self->{$name} ; + goto &$AUTOLOAD; } diff --git a/perl/DXDb.pm b/perl/DXDb.pm index b7a88671..6a57dc7c 100644 --- a/perl/DXDb.pm +++ b/perl/DXDb.pm @@ -348,7 +348,6 @@ sub field_prompt #no strict; sub AUTOLOAD { - my $self = shift; no strict; my $name = $AUTOLOAD; return if $name =~ /::DESTROY$/; @@ -358,9 +357,7 @@ sub AUTOLOAD # 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}}; - &$AUTOLOAD($self, @_); -# *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ; -# @_ ? $self->{$name} = shift : $self->{$name} ; + goto &$AUTOLOAD; } 1; diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index e90a6bb1..5773c7e9 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -1518,7 +1518,6 @@ sub import_one #no strict; sub AUTOLOAD { - my $self = shift; no strict; my $name = $AUTOLOAD; return if $name =~ /::DESTROY$/; @@ -1528,9 +1527,7 @@ sub AUTOLOAD # 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}}; - &$AUTOLOAD($self, @_); -# *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ; -# @_ ? $self->{$name} = shift : $self->{$name} ; + goto &$AUTOLOAD; } 1; diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 60b0f1e6..53bd418b 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -1607,9 +1607,8 @@ sub send_local_config # get all the users connected on the above nodes and send them out foreach $node (@localnodes, @remotenodes) { if ($node) { - $self->send_route(\&pc16, 1, $node, - map {my $r = Route::User::get($_); $r ? ($r) : ()} $node->users) - if $self->user->wantsendpc16; + my @rout = map {my $r = Route::User::get($_); $r ? ($r) : ()} $node->users; + $self->send_route(\&pc16, 1, $node, @rout) if @rout && $self->user->wantsendpc16; } else { dbg("sent a null value") if isdbg('chanerr'); } diff --git a/perl/DXUser.pm b/perl/DXUser.pm index cf847bc8..dec317a1 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -91,7 +91,6 @@ $lrusize = 2000; #no strict; sub AUTOLOAD { - my $self = shift; no strict; my $name = $AUTOLOAD; @@ -102,12 +101,7 @@ sub AUTOLOAD # 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}}; - &$AUTOLOAD($self, @_); -# *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ; -# if (@_) { -# $self->{$name} = shift; -# } -# return $self->{$name}; + goto &$AUTOLOAD; } #use strict; diff --git a/perl/Prefix.pm b/perl/Prefix.pm index 6f1c1f29..1e6e50c2 100644 --- a/perl/Prefix.pm +++ b/perl/Prefix.pm @@ -453,7 +453,6 @@ my %valid = ( sub AUTOLOAD { - my $self = shift; no strict; my $name = $AUTOLOAD; @@ -464,7 +463,7 @@ sub AUTOLOAD # 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}} ; - &$AUTOLOAD($self, @_); + goto &$AUTOLOAD; } # diff --git a/perl/Prot.pm b/perl/Prot.pm index 17e3d517..23de1538 100644 --- a/perl/Prot.pm +++ b/perl/Prot.pm @@ -53,8 +53,6 @@ sub new sub AUTOLOAD { -# no strict "refs"; - my $self = shift; no strict; my $name = $AUTOLOAD; return if $name =~ /::DESTROY$/; @@ -62,9 +60,7 @@ sub AUTOLOAD confess "Non-existant field '$AUTOLOAD'" if !$valid{$name}; *$AUTOLOAD = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}}; - &$AUTOLOAD($self, @_); -# *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ; -# @_ ? $self->{$name} = shift : $self->{$name} ; + goto &$AUTOLOAD; } 1; diff --git a/perl/Route.pm b/perl/Route.pm index 38740766..a9f80fea 100644 --- a/perl/Route.pm +++ b/perl/Route.pm @@ -380,7 +380,6 @@ sub field_prompt # sub AUTOLOAD { - my $self = shift; no strict; my $name = $AUTOLOAD; return if $name =~ /::DESTROY$/; @@ -390,10 +389,9 @@ sub AUTOLOAD # 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}}; - &$AUTOLOAD($self, @_); + *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}}; + goto &$AUTOLOAD; -# @_ ? $self->{$name} = shift : $self->{$name} ; } 1; diff --git a/perl/Route/Node.pm b/perl/Route/Node.pm index 1fbd8f71..0c2b2e4a 100644 --- a/perl/Route/Node.pm +++ b/perl/Route/Node.pm @@ -315,19 +315,16 @@ sub DESTROY sub AUTOLOAD { no strict; - - my $self = shift; - $name = $AUTOLOAD; + my $name = $AUTOLOAD; return if $name =~ /::DESTROY$/; - $name =~ s/.*:://o; + $name =~ s/^.*:://o; 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 -# print "AUTOLOAD: $AUTOLOAD\n"; -# *{$AUTOLOAD} = sub {my $self = shift; @_ ? $self->{$name} = shift : $self->{$name}} ; - @_ ? $self->{$name} = shift : $self->{$name} ; + *$AUTOLOAD = sub {$_[0]->{$name} = $_[1] if @_ > 1; return $_[0]->{$name}}; + goto &$AUTOLOAD; } 1; diff --git a/perl/Route/User.pm b/perl/Route/User.pm index bf72bbb5..b9862e6d 100644 --- a/perl/Route/User.pm +++ b/perl/Route/User.pm @@ -104,18 +104,17 @@ sub delparent 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;