X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXCluster.pm;h=09001b2070c10a613aa5c68886457b9def4c6a86;hb=fa57f72c26032aae4c1a20358e829ba9afbf460c;hp=51c63f8239ed7af492148b68cf5f67007a5254af;hpb=099c6b4a10d9f1e7471b0c94273cd992b5814cdc;p=spider.git diff --git a/perl/DXCluster.pm b/perl/DXCluster.pm index 51c63f82..09001b20 100644 --- a/perl/DXCluster.pm +++ b/perl/DXCluster.pm @@ -49,11 +49,45 @@ sub alloc return $self; } +# get an entry exactly as it is +sub get_exact +{ + my ($pkg, $call) = @_; + + # belt and braces + $call = uc $call; + + # search for 'as is' only + return $cluster{$call}; +} + +# # search for a call in the cluster +# taking into account SSIDs +# sub get { my ($pkg, $call) = @_; - return $cluster{$call}; + + # belt and braces + $call = uc $call; + + # search for 'as is' + my $ref = $cluster{$call}; + return $ref if $ref; + + # search for the unSSIDed one + $call =~ s/-\d+$//o; + $ref = $cluster{$call}; + return $ref if $ref; + + # search for the SSIDed one + my $i; + for ($i = 1; $i < 17; $i++) { + $ref = $cluster{"$call-$i"}; + return $ref if $ref; + } + return undef; } # get all @@ -137,7 +171,7 @@ sub new { my ($pkg, $dxchan, $node, $call, $confmode, $here) = @_; - die "tried to add $call when it already exists" if DXCluster->get($call); + die "tried to add $call when it already exists" if DXCluster->get_exact($call); my $self = $pkg->alloc($dxchan, $call, $confmode, $here); $self->{mynode} = $node;