chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.db-live.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
AJAX route validator improved
[ypp-sc-tools.db-live.git]
/
yarrg
/
web
/
routetextstring
diff --git
a/yarrg/web/routetextstring
b/yarrg/web/routetextstring
index 0e4ae6eaf2b37d5786c05800ab1497dd7d1c6302..b84fd8447708e70b4b463ab10fdf2719545cc1d0 100644
(file)
--- a/
yarrg/web/routetextstring
+++ b/
yarrg/web/routetextstring
@@
-6,6
+6,10
@@
$string
</%args>
<%perl>
</%args>
<%perl>
+# typical url for this script:
+# http://www.chiark.greenend.org.uk/ucgi/~clareb/mason/pirates/routetextstring?format=json&ocean=Midnight&string=d
+
+
use CommodsWeb;
use HTML::Entities;
use JSON;
use CommodsWeb;
use HTML::Entities;
use JSON;
@@
-29,7
+33,7
@@
if ($format =~ 'json') {
})};
$output_wrong= sub { print to_json({
success => 0,
})};
$output_wrong= sub { print to_json({
success => 0,
- show =>
encode_entities($_[0])
,
+ show =>
$_[0]
,
})};
}
})};
}
@@
-47,7
+51,7
@@
foreach my $each (split m#[/|,]#, $string) {
if (!@$results) {
$err->('no island or arch matches "%s"');
} elsif (@$results > 3) {
if (!@$results) {
$err->('no island or arch matches "%s"');
} elsif (@$results > 3) {
- $err->('');
+ $err->('
');
} elsif (@$results > 1) {
my @m= map { $_->[2] } @$results;
$err->('ambiguous island or arch "%s", could be '.
} elsif (@$results > 1) {
my @m= map { $_->[2] } @$results;
$err->('ambiguous island or arch "%s", could be '.