cq => '0,CQ Zone',
state => '0,State',
city => '0,City',
+ lastseen => 'Last Seen,atime',
);
$filterdef = bless ([
dbg("create $pkg with $call") if isdbg('routelow');
# add in all the dxcc, itu, zone info
- my @dxcc = Prefix::extract($call);
- if (@dxcc > 0) {
- $self->{dxcc} = $dxcc[1]->dxcc;
- $self->{itu} = $dxcc[1]->itu;
- $self->{cq} = $dxcc[1]->cq;
- $self->{state} = $dxcc[1]->state;
- $self->{city} = $dxcc[1]->city;
- }
+ ($self->{dxcc}, $self->{itu}, $self->{cq}, $self->{state}, $self->{city}) =
+ Prefix::cty_data($call);
+
$self->{flags} = here(1);
return $self;
return $r ? 1 : 0;
}
-sub parents
-{
- my $self = shift;
- return @{$self->{parent}};
-}
-
#
# display routines
#
# it isn't, build up a list of dxchannels and possible ping times
# for all the candidates.
unless (@dxchan) {
- foreach my $p (@{$self->{parent}}) {
-# dbg("Trying parent $p") if isdbg('routech');
+ foreach my $p (@{$self->{dxchan}}) {
+# dbg("Trying dxchan $p") if isdbg('routech');
next if $p eq $main::mycall; # the root
my $dxchan = DXChannel->get($p);
if ($dxchan) {
return @dxchan;
}
-sub dxchan
+sub bestdxchan
{
my $self = shift;
my $dxchan = DXChannel->get($self->call);
return $dxchan if $dxchan;
- my @dxchan = $self->alldxchan;
+ my @dxchan = sort { ($a->pingave || 9999999) <=> ($b->pingave || 9999999) } $self->alldxchan;
return undef unless @dxchan;
- # determine the minimum ping channel
- my $minping = 99999999;
- foreach my $dxc (@dxchan) {
- my $p = $dxc->pingave;
- if (defined $p && $p < $minping) {
- $minping = $p;
- $dxchan = $dxc;
- }
- }
- $dxchan = shift @dxchan unless $dxchan;
- return $dxchan;
+ return shift @dxchan;
}
-
-
#
# track destruction
#
#
sub AUTOLOAD
{
- my $self = shift;
no strict;
my $name = $AUTOLOAD;
return if $name =~ /::DESTROY$/;
# 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;