chiark / gitweb /
website copes with older JSON.pm
[ypp-sc-tools.main.git] / yarrg / web / routetextstring
index 8787073c918ae89203ca06df7b4888244fc907fa..be009d4e5a4b8fa624a5f809a079a432d0b1da2f 100755 (executable)
 
 
 </%doc>
+
+<%flags>
+inherit => undef
+</%flags>
+
 <%args>
 $ocean
 $format
 $ctype => undef
 $string
 </%args>
+
 <%perl>
 
 # typical url for this script:
@@ -63,12 +69,12 @@ my ($output, $output_wrong);
 
 if ($format =~ /json/) {
        $r->content_type($ctype or $format);
-       $output= sub { print to_json({
+       $output= sub { print to_json_shim({
                success => 1,
                show => length $canontext ? encode_entities($canontext)
                        : '&nbsp;',
                })};
-       $output_wrong= sub { print to_json({
+       $output_wrong= sub { print to_json_shim({
                success => 0,
                show => $_[0],
                })};
@@ -102,7 +108,7 @@ foreach my $each (split m#[/|,]#, $string) {
        if (!$results) {
                if (!%m) {
                        return $err->('no island or arch matches "%s"');
-               } elsif (%m > 5) {
+               } elsif (keys(%m) > 5) {
                        return $err->('&nbsp;');
                } else {
                        return $err->('ambiguous island or arch "%s",'.