add xml version of sh/qrz
[spider.git] / perl / Spot.pm
index 76d6e0b63191036f733d168e08636447e684f0ea..e7227ab1b2cdff4e313b95266b935756e2d0d5c5 100644 (file)
@@ -21,7 +21,8 @@ use QSL;
 
 use strict;
 
-use vars qw($fp $statp $maxspots $defaultspots $maxdays $dirprefix $duplth $dupage $filterdef $totalspots $hfspots $vhfspots $maxcalllth $can_encode);
+use vars qw($fp $statp $maxspots $defaultspots $maxdays $dirprefix $duplth $dupage $filterdef
+                       $totalspots $hfspots $vhfspots $maxcalllth $can_encode $use_db_for_search);
 
 $fp = undef;
 $statp = undef;
@@ -52,6 +53,7 @@ $filterdef = bless ([
                                         
                         ], 'Filter::Cmd');
 $totalspots = $hfspots = $vhfspots = 0;
+$use_db_for_search = 0;
 
 # create a Spot Object
 sub new
@@ -250,7 +252,7 @@ sub search
        
        $to = $from + $maxspots if $to - $from > $maxspots || $to - $from <= 0;
 
-       if ($main::dbh) {
+       if ($main::dbh && $use_db_for_search) {
                return $main::dbh->spot_search($expr, $dayfrom, $dayto, $to-$from, $dxchan);
        }
 
@@ -402,7 +404,7 @@ sub dup
                }
        }
        my $otext = $text;
-       $text = Encode::encode("iso-8859-1", $text) if $main::can_encode && Encode::is_utf8($text, 1);
+#      $text = Encode::encode("iso-8859-1", $text) if $main::can_encode && Encode::is_utf8($text, 1);
        $text =~ s/^\+\w+\s*//;                 # remove leading LoTW callsign
        $text =~ s/\s{2,}[\dA-Z]?[A-Z]\d?$// if length $text > 24;
        $text =~ s/[\W\x00-\x2F\x7B-\xFF]//g; # tautology, just to make quite sure!