Callsign/DB/QRZ.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 51 CC 2 SCAR 10.6
CC
2
Cov
0%
do_lookup
6.0
init
2.0
do_load_data
2.0
CRAP 2.9
1 # Copyright (C) 2008 Wes Hardaker
2 # License: Same as perl. See the LICENSE file for details.
3 package Ham::Callsign::DB::QRZ;
4  
5 use Ham::Callsign::DB;
6 use Ham::Callsign;
7 use Ham::Scraper;
8  
9 our @ISA = qw(Ham::Callsign::DB);
10  
11 use strict;
12  
13 sub init {
14 my ($self) = @_;
15 # none needed
16 }
17  
18 sub do_load_data {
19 my ($self, $place) = @_;
20 # none needed.
21 }
22  
23 sub do_lookup {
24 my ($self, $callsign) = @_;
25  
26 my %qrz = Ham::Scraper::QRZ($callsign);
27 my %results = (%qrz, FromDB => 'QRZ');
28  
29 return if (!$results{'Name'});
30  
31 $results{'thecallsign'} = uc($callsign);
32 $results{'entity_name'} = $qrz{'Name'};
33  
34 $results{'first_name'} = $qrz{'Name'};
35 $results{'first_name'} =~ s/ .*//;
36  
37 $results{'last_name'} = $qrz{'Name'};
38 $results{'last_name'} =~ s/.* //;
39  
40 $results{'city'} = $qrz{'CityStateZip'};
41 $results{'city'} =~ s/,* .*//;
42  
43 $results{'zip'} = $qrz{'CityStateZip'};
44 $results{'zip'} =~ s/.*(\d+)$/$1/;
45  
46 $results{'state'} = $qrz{'CityStateZip'};
47 $results{'state'} =~ s/.* ([A-Z][A-Z]) .*/$1/;
48  
49 $results{'qth'} = $qrz{'CityStateZip'} . ", " . $qrz{'Grid'};
50  
51 foreach my $xfer (qw(CityStateZip TimeZone GMTOffset Grid)) {
52 $results{$xfer} = $qrz{$xfer};
53 }
54  
55 return [new Ham::Callsign(%results)];
56 }
57  
58 sub do_create_tables {
59 my ($self) = @_;
60  
61 # not needed
62 }
63  
64 1;
65  
66 =pod
67  
68 =head1 NAME
69  
70 =cut
71  
72