3 # Local 'autoqsl' module for DXSpider
5 # Copyright (c) 2003 Dirk Koopman G1TLH
17 use vars qw($qslfn $dbm);
24 my $ufn = "$main::root/data/$qslfn.v1";
26 Prefix::load() unless Prefix::loaded();
33 dbg("Storable appears to be missing");
34 dbg("In order to use the QSL feature you must");
35 dbg("load Storable from CPAN");
38 import Storable qw(nfreeze freeze thaw);
41 $dbm = tie (%u, 'DB_File', $ufn, O_CREAT|O_RDWR, 0666, $DB_BTREE) or confess "can't open qsl file: $qslfn ($!)";
43 $dbm = tie (%u, 'DB_File', $ufn, O_RDONLY, 0666, $DB_BTREE) or confess "can't open qsl file: $qslfn ($!)";
55 my ($pkg, $call) = @_;
56 return bless [uc $call, []], $pkg;
59 # the format of each entry is [manager, times found, last time, last reporter]
69 foreach my $man (split /\b/, uc $line) {
72 if (is_callsign($man)) {
73 my @pre = Prefix::extract($man);
74 $tok = $man if @pre && $pre[0] ne 'Q';
75 } elsif ($man =~ /^BUR/) {
77 } elsif ($man eq 'HC' || $man =~ /^HOM/ || $man =~ /^DIR/) {
79 } elsif ($man =~ /^QRZ/) {
83 my ($r) = grep {$_->[0] eq $tok} @{$self->[1]};
92 $r = [$tok, 1, $t, $by];
93 unshift @{$self->[1]}, $r;
98 $self->put if $changed;
103 return undef unless $dbm;
107 my $r = $dbm->get($key, $value);
116 my $key = $self->[0];
117 my $value = nfreeze($self);
118 $dbm->put($key, $value);