3 # Local 'autoqsl' module for DXSpider
5 # Copyright (c) 2003 Dirk Koopman G1TLH
17 use vars qw($qslfn $dbm);
21 localdata_mv("$qslfn.v1");
26 my $ufn = localdata("$qslfn.v1");
28 Prefix::load() unless Prefix::loaded();
35 dbg("Storable appears to be missing");
36 dbg("In order to use the QSL feature you must");
37 dbg("load Storable from CPAN");
40 import Storable qw(nfreeze freeze thaw);
43 $dbm = tie (%u, 'DB_File', $ufn, O_CREAT|O_RDWR, 0666, $DB_BTREE) or confess "can't open qsl file: $qslfn ($!)";
45 $dbm = tie (%u, 'DB_File', $ufn, O_RDONLY, 0666, $DB_BTREE) or confess "can't open qsl file: $qslfn ($!)";
57 my ($pkg, $call) = @_;
58 return bless [uc $call, []], $pkg;
61 # the format of each entry is [manager, times found, last time, last reporter]
71 foreach my $man (split /\b/, uc $line) {
74 if (is_callsign($man)) {
75 my @pre = Prefix::extract($man);
76 $tok = $man if @pre && $pre[0] ne 'Q';
77 } elsif ($man =~ /^BUR/) {
79 } elsif ($man eq 'HC' || $man =~ /^HOM/ || $man =~ /^DIR/) {
81 } elsif ($man =~ /^QRZ/) {
85 my ($r) = grep {$_->[0] eq $tok} @{$self->[1]};
94 $r = [$tok, 1, $t, $by];
95 unshift @{$self->[1]}, $r;
100 $self->put if $changed;
105 return undef unless $dbm;
109 my $r = $dbm->get($key, $value);
118 my $key = $self->[0];
119 my $value = nfreeze($self);
120 $dbm->put($key, $value);