chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.main.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cope with JSON.pm version 2 which has an incompatible change
[ypp-sc-tools.main.git]
/
pctb
/
database-info-fetch
diff --git
a/pctb/database-info-fetch
b/pctb/database-info-fetch
index b7ebe4159292c98456ba73239b3a3d2ff2026f17..d3619caba4b3f15b70c219cc8b46e5b7a986c4d2 100755
(executable)
--- a/
pctb/database-info-fetch
+++ b/
pctb/database-info-fetch
@@
-68,13
+68,24
@@
sub ptcl ($) {
p("{$_[0]}");
}
p("{$_[0]}");
}
+sub json_convert_shim ($) {
+ my ($json) = @_;
+ # In JSON.pm 2.x, jsonToObj prints a warning to stderr which
+ # our callers don't like at all.
+ if ($JSON::VERSION >= 2) {
+ return from_json($json);
+ } else {
+ return jsonToObj($json);
+ }
+}
+
sub get_arches_islands () {
my $ocean= $ENV{'YPPSC_OCEAN'}; die unless $ocean;
my $url= "$pctb/islands.php?oceanName=".uc $ocean;
my $resp= $ua->get($url);
die $resp->status_line unless $resp->is_success;
$jsonresp= $resp->content;
sub get_arches_islands () {
my $ocean= $ENV{'YPPSC_OCEAN'}; die unless $ocean;
my $url= "$pctb/islands.php?oceanName=".uc $ocean;
my $resp= $ua->get($url);
die $resp->status_line unless $resp->is_success;
$jsonresp= $resp->content;
- my $jobj= json
ToObj
($resp->content);
+ my $jobj= json
_convert_shim
($resp->content);
my $arches= [ jparsetable($jobj, 'arches') ];
my $islands= [ jparsetable($jobj, 'islands') ];
return ($arches,$islands);
my $arches= [ jparsetable($jobj, 'arches') ];
my $islands= [ jparsetable($jobj, 'islands') ];
return ($arches,$islands);