X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/2b719dc0950d9e160458490cb1c69b7cd37d240d..027a60ece8b12690c09b5e433339b03e55df065b:/chars.plp
diff --git a/chars.plp b/chars.plp
index 5d9a3e2..bea56cf 100644
--- a/chars.plp
+++ b/chars.plp
@@ -2,7 +2,7 @@
Html({
title => 'character support sheet',
- version => '1.0',
+ version => '1.1',
keywords => [qw'
unicode glyph char character reference common ipa symbol sign mark table digraph
'],
@@ -62,8 +62,7 @@ my $query = eval {
say "
$title
";
if (!$query) {
- Alert('Unicode group not specified', $@);
- exit;
+ Abort(["Unicode group not found", $@], '404 no matches');
};
for ($parent || 'Unicode range') {
@@ -82,15 +81,16 @@ for ($parent || 'Unicode range') {
my @chars;
for (map { split /[^\d-]/ } $query) {
my @range = split /-/, $_, 2;
- m/^[0-9]+$/ or die "Invalid code point $_ in query $query\n" for @range;
+ m/^[0-9]+$/ or Abort("Invalid code point $_ in query $query", 400)
+ for @range;
push @chars, chr $_ for $range[0] .. ($range[1] // $range[0]);
}
-@chars or die "No match for query $query\n";
+@chars or Abort("No match for query $query", '404 no results');
-@chars <= 1500 or die sprintf(
- 'Too many matches (%d) for query %s'."\n",
- scalar @chars, $query,
+@chars <= 1500 or Abort(
+ sprintf('Too many matches (%d) for query', scalar @chars),
+ '403 not allowed', $query
);
# output character list