fix spots array so that the correct no of fields are always available.
[spider.git] / perl / VE7CC.pm
index 2679ff1e4e2f39dda68d71821c6e9a8faa9fb65b..e6634b6209c7d80ef8c76f5e879e75f9b0734e30 100644 (file)
@@ -30,12 +30,16 @@ sub dx_spot
        my $freq = shift;
        my $spotted = shift;
        my $t = shift;
+
+       # remove any items above the top of the max spot data
+       pop while @_ > 11;
        
-       # remove interface callsign;
-       pop;
+       # make sure both US states are defined
+       $_[9] ||= '';
+       $_[10] ||= '';
        
-       my $spotted_cc = (Prefix::cty_data($spotted))[5];
-       my $spotter_cc = (Prefix::cty_data($_[1]))[5];
+       my $spotter_cc = (Prefix::cty_data($spotted))[5];
+       my $spotted_cc = (Prefix::cty_data($_[1]))[5];
        
        return sprintf("CC11^%0.1f^%s^", $freq, $spotted) . join('^', cldate($t), ztime($t), @_, $spotter_cc, $spotted_cc);
 }