- for ($i = length $sp; $i >= 1; --$i) {
- my $ssp = substr($sp, 0, $i);
- my @wout = get($ssp);
- if (isdbg('prefix')) {
- my $part = $wout[0] || "*";
- $part .= '*' unless $part eq '*' || $part eq $ssp;
- dbg("Partial prefix: $sp $ssp $part" );
- }
- next if @wout > 0 && $wout[0] gt $ssp;
-
- # try and search for it in the descriptions as
- # a whole callsign if it has multiple parts and the output
- # is more two long, this should catch things like
- # FR5DX/T without having to explicitly stick it into
- # the prefix table.
-
- if (@wout) {
- if (@parts > 1) {
- $parts[$k] = $ssp;
- my $try = join('/', @parts);
- my @try = get($try);
- if (isdbg('prefix')) {
- my $part = $try[0] || "*";
- $part .= '*' unless $part eq '*' || $part eq $try;
- dbg("Compound prefix: $try $part" );
- }
- if (@try == 0) {
- $try = join('/', reverse @parts);
- @try = get($try);
- if (isdbg('prefix')) {
- my $part = $try[0] || "*";
- $part .= '*' unless $part eq '*' || $part eq $try;
- dbg("Compound prefix: $try $part" );
- }
- }
- if (@try && $try eq $try[0]) {
- push @out, @try;
- } else {
- push @out, @wout;
- }
+ @nout = matchprefix($sp);
+
+ # try and search for it in the descriptions as
+ # a whole callsign if it has multiple parts and the output
+ # is more two long, this should catch things like
+ # FR5DX/T without having to explicitly stick it into
+ # the prefix table.
+
+ if (@nout) {
+ if (@parts > 1) {
+ $parts[$k] = $nout[0];
+ my $try = join('/', @parts);
+ my @try = get($try);
+ if (isdbg('prefix')) {
+ my $part = $try[0] || "*";
+ $part .= '*' unless $part eq '*' || $part eq $try;
+ dbg("Compound prefix: $try $part" );
+ }
+ if (@try && $try eq $try[0]) {
+ $misses++;
+ $lru->put($call, \@try);
+ push @out, @try;