added some more pc16/17 routing code
[spider.git] / perl / Route.pm
index 387407669583ff325644bbc51d9517d1fc215de6..b4e11b4d1da5a295ef3566e798409f9e209b3339 100644 (file)
@@ -68,14 +68,9 @@ sub new
        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; 
@@ -146,9 +141,11 @@ sub is_empty
 # These can be called in various ways:-
 #
 # Route::here or $ref->here returns 1 or 0 depending on value of the here flag
-# Route::here(1) returns 2 (the bit value of the here flag)
+# Route::here(1) returns 1 (the bit value of the here flag)
 # $ref->here(1) or $ref->here(0) sets the here flag
 #
+# these are now redundant really as we are not interested in conferences
+# and here is back to being '1'.
 
 sub here
 {
@@ -156,7 +153,7 @@ sub here
        my $r = shift;
        return $self ? 2 : 0 unless ref $self;
        return ($self->{flags} & 2) ? 1 : 0 unless defined $r;
-       $self->{flags} = (($self->{flags} & ~2) | ($r ? 2 : 0));
+       $self->{flags} = (($self->{flags} & ~1) | ($r ? 1 : 0));
        return $r ? 1 : 0;
 }
 
@@ -164,10 +161,10 @@ sub conf
 {
        my $self = shift;
        my $r = shift;
-       return $self ? 1 : 0 unless ref $self;
+       return $self ? 2 : 0 unless ref $self;
        return ($self->{flags} & 1) ? 1 : 0 unless defined $r;
-       $self->{flags} = (($self->{flags} & ~1) | ($r ? 1 : 0));
-       return $r ? 1 : 0;
+       $self->{flags} = (($self->{flags} & ~2) | ($r ? 2 : 0));
+       return $r ? 2 : 0;
 }
 
 sub parents
@@ -380,7 +377,6 @@ sub field_prompt
 #
 sub AUTOLOAD
 {
-       my $self = shift;
        no strict;
        my $name = $AUTOLOAD;
        return if $name =~ /::DESTROY$/;
@@ -390,10 +386,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;