X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fweb%2Froutetextstring;fp=yarrg%2Fweb%2Froutetextstring;h=4cec5f9d337b1f994f694857ec528887a5c2828a;hb=beff42c07503b7a74bd455d1c299341d16a493cd;hp=70d614483d4efe3de4888af97413388628d2061d;hpb=23291f0a7104f790bc1309154864e97a8522c428;p=ypp-sc-tools.db-test.git diff --git a/yarrg/web/routetextstring b/yarrg/web/routetextstring index 70d6144..4cec5f9 100644 --- a/yarrg/web/routetextstring +++ b/yarrg/web/routetextstring @@ -46,23 +46,23 @@ foreach my $each (split m#[/|,]#, $string) { $output_wrong->($msg); $m->abort(); }; - my @m; + my %m; my $results; foreach my $pat ("$each\%", "\%$each\%") { $sth->execute($pat,$pat); $results= $sth->fetchall_arrayref(); last if @$results==1; - push @m, @$results; + map { $m{ $_->[2] }=1 } @$results; $results= undef; } if (!$results) { - if (!@m) { + if (!%m) { $err->('no island or arch matches "%s"'); - } elsif (@m > 3) { + } elsif (%m > 5) { $err->(' '); } else { $err->('ambiguous island or arch "%s", could be '. - join(', ', map { $_->[2] } @m)); + join(', ', sort keys %m)); } } push @results, $results->[0];