3 # Local 'autoqsl' module for DXSpider
5 # Copyright (c) 2003 Dirk Koopman G1TLH
16 use vars qw($VERSION $BRANCH);
17 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
18 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
19 $main::build += $VERSION;
20 $main::branch += $BRANCH;
22 use vars qw($qslfn $dbm);
29 my $ufn = "$main::root/data/$qslfn.v1";
36 dbg("Storable appears to be missing");
37 dbg("In order to use the QSL feature you must");
38 dbg("load Storable from CPAN");
41 import Storable qw(nfreeze thaw);
44 $dbm = tie (%u, 'DB_File', $ufn, O_CREAT|O_RDWR, 0666, $DB_BTREE) or confess "can't open qsl file: $qslfn ($!)";
46 $dbm = tie (%u, 'DB_File', $ufn, O_RDONLY, 0666, $DB_BTREE) or confess "can't open qsl file: $qslfn ($!)";
58 my ($pkg, $call) = @_;
59 return bless [uc $call, []], $pkg;
62 # the format of each entry is [manager, times found, last time]
71 my @tok = map {/^BUR/ || is_callsign($_) ? $_ : ()} split(/\b/, uc $line);
72 foreach my $man (@tok) {
73 $man = 'BUREAU' if $man =~ /^BUR/;
74 my ($r) = grep {$_->[0] eq $man} @{$self->[1]};
82 $r = [$man, 1, $t, $by];
83 push @{$self->[1]}, $r;
92 return undef unless $dbm;
95 my $r = $dbm->get($key, $value);
104 my $key = $self->[0];
105 my $value = nfreeze($self);
106 $dbm->put($key, $value);