diff options
author | Yorhel <git@yorhel.nl> | 2015-01-02 11:36:46 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2015-01-02 11:36:46 +0100 |
commit | aeb9646445b3cef659ce60b343b38c80015db5c0 (patch) | |
tree | 46b317522de866b07152d74582fd208515b7c02a /lib/VNDB/Func.pm | |
parent | e875b3b1602393efc80267651fc5bf2b819e2085 (diff) |
staff: Don't allow empty staff revisions
Diffstat (limited to 'lib/VNDB/Func.pm')
-rw-r--r-- | lib/VNDB/Func.pm | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index 3b315c93..ac9fdd58 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -204,16 +204,18 @@ sub fmtvote { } -my $JSON; # cache +# JSON::XS::encode_json converts input to utf8, whereas the below functions +# operate on wide character strings. Canonicalization is enabled to allow for +# proper comparison of serialized objects. +my $JSON = JSON::XS->new; +$JSON->canonical(1); -# JSON::XS::encode_json converts input to utf8, whereas these functions -# operate on wide character strings. sub jsonEncode ($) { - ($JSON ||= JSON::XS->new)->encode(@_); + $JSON->encode(@_); } sub jsonDecode ($) { - ($JSON ||= JSON::XS->new)->decode(@_); + $JSON->decode(@_); } # Insert JSON-encoded data as script, arguments: id, object |