fix warnings on $BRANCH
[spider.git] / perl / VE7CC.pm
1 #
2 # VE7CC variations for DXCommandmode
3 #
4 # This is done this way because a) there aren't very many and 
5 # b) because it isn't easy to reliably rebless the object in
6 # flight (as it were).
7 #
8 # This could change.
9 #
10
11 package VE7CC;
12
13 use DXVars;
14 use DXDebug;
15 use DXUtil;
16 use Julian;
17 use Prefix;
18 use DXUser;
19
20 use strict;
21
22 use vars qw($VERSION $BRANCH);
23 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
24 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /^\d+\.\d+(?:\.(\d+)\.(\d+))?$/  || (0,0));
25 $main::build += $VERSION;
26 $main::branch += $BRANCH;
27
28 sub dx_spot
29 {
30         my $self = shift;                       # this may be useful some day
31         my $spot = ref $_[0] ? shift : \@_;
32         my $freq = $spot->[0];
33         my $spotted = $spot->[1];
34         my $t = $spot->[2];
35         my $loc_spotted = '';
36         my $loc_spotter = '';
37         my $ref = DXUser->get_current($spotted);
38         if ($ref) {
39                 my $loc = $ref->qra || '';
40                 $loc_spotted =substr($loc, 0, 4) if $loc;
41         }
42
43         # remove any items above the top of the max spot data
44         pop while @_ > 14;
45         
46         # make sure both US states are defined
47         $_[12] ||= '';
48         $_[13] ||= '';
49         
50         my $spotted_cc = (Prefix::cty_data($spotted))[5];
51         my $spotter_cc = (Prefix::cty_data($_[4]))[5];
52         $ref = DXUser->get_current($_[4]);
53         if ($ref) {
54                 my $loc = $ref->qra || '';
55                 $loc_spotter = substr($loc, 0, 4) if $loc;
56         }
57         
58         return sprintf("CC11^%0.1f^%s^", $freq, $spotted) . join('^', cldate($t), ztime($t), @$spot[3..-1], $spotted_cc, $spotter_cc, $loc_spotted, $loc_spotter);
59 }
60
61 1;