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
WIP chart parser
[ypp-sc-tools.db-live.git]
/
yarrg
/
CommodsWeb.pm
diff --git
a/yarrg/CommodsWeb.pm
b/yarrg/CommodsWeb.pm
index 46b32e6763ebb25d2b75f0f1a3a6670b63caf1a2..d423a299c48136c20d7fe9ab3c408cffba402ec7 100644
(file)
--- a/
yarrg/CommodsWeb.pm
+++ b/
yarrg/CommodsWeb.pm
@@
-52,7
+52,8
@@
BEGIN {
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw(&dbw_connect &ocean_list $sourcebasedir
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw(&dbw_connect &ocean_list $sourcebasedir
- to_json to_json_protecttags);
+ &to_json_shim &to_json_protecttags
+ &set_ctype_utf8);
%EXPORT_TAGS = ( );
@EXPORT_OK = qw();
%EXPORT_TAGS = ( );
@EXPORT_OK = qw();
@@
-102,9
+103,20
@@
sub dbw_connect ($) {
return dbr_connect($datadir, $ocean);
}
return dbr_connect($datadir, $ocean);
}
+sub to_json_shim ($) {
+ my ($obj) = @_;
+ # In JSON.pm 2.x, jsonToObj prints a warning to stderr which
+ # our callers don't like at all.
+ if ($JSON::VERSION >= 2.0) {
+ return to_json($obj);
+ } else {
+ return objToJson($obj);
+ }
+}
+
sub to_json_protecttags ($) {
my ($v) = @_;
sub to_json_protecttags ($) {
my ($v) = @_;
- my $j= to_json($v);
+ my $j= to_json
_shim
($v);
$j =~ s,/,\\/,g;
return $j;
}
$j =~ s,/,\\/,g;
return $j;
}