diff options
author | Yorhel <git@yorhel.nl> | 2015-09-17 16:31:04 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2015-09-17 16:31:04 +0200 |
commit | a8ece1d324bbbbb675224af97cf5dcb15580d577 (patch) | |
tree | 72f7bd8a1d5536615130550e62ef0f671ac5aff7 /lib/VNDB/Func.pm | |
parent | a16c4bbbbd97fecb7a02a535efce0fefb1424ca9 (diff) |
Rename jsonEncode/Decode to C-style naming
CamelCase is used for methods, C-style names for functions. I'm just
nitpicking now.
Diffstat (limited to 'lib/VNDB/Func.pm')
-rw-r--r-- | lib/VNDB/Func.pm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index dd3f292e..40af8e73 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -11,7 +11,7 @@ use VNDBUtil; our @EXPORT = (@VNDBUtil::EXPORT, qw| clearfloat cssicon tagscore mt minage fil_parse fil_serialize parenttags childtags charspoil imgpath imgurl fmtvote - jsonEncode jsonDecode script_json json_validate + json_encode json_decode script_json json_validate mtvoiced mtani mtvnlen mtrlstat mtvnlstat mtbloodt |); @@ -210,18 +210,18 @@ sub fmtvote { my $JSON = JSON::XS->new; $JSON->canonical(1); -sub jsonEncode ($) { +sub json_encode ($) { $JSON->encode(@_); } -sub jsonDecode ($) { +sub json_decode ($) { $JSON->decode(@_); } # Insert JSON-encoded data as script, arguments: id, object sub script_json { script id => $_[0], type => 'application/json'; - my $js = jsonEncode $_[1]; + my $js = json_encode $_[1]; $js =~ s/</\\u003C/g; # escape HTML tags like </script> and <!-- lit $js; end; @@ -236,7 +236,7 @@ sub script_json { # responsibility of the JS code to handle the interface with the user. sub json_validate { my($frm, $name, @fields) = @_; - my $data = eval { jsonDecode $frm->{$name} }; + my $data = eval { json_decode $frm->{$name} }; goto error if $@ || ref $data ne 'ARRAY'; my %known_fields = map +($_->{field},1), @fields; for my $i (0..$#$data) { |