Mojo::JSON OO api is deprecated
authorVincent Tondellier <tonton+hg@team1664.org>
Sun, 25 Jan 2015 22:45:57 +0100
changeset 55 8d9daa16ccad
parent 54 2218a127abd9
child 56 2a4d97741155
Mojo::JSON OO api is deprecated
bin/fs_to_db.pl
bin/gearman_decode_worker.pl
--- a/bin/fs_to_db.pl	Tue Nov 11 21:35:24 2014 +0100
+++ b/bin/fs_to_db.pl	Sun Jan 25 22:45:57 2015 +0100
@@ -16,8 +16,8 @@
 use Mojo::Base -strict;
 use lib 'lib';
 
-use Mojo::JSON;
-use Mojo::Util qw(decode slurp);
+use Mojo::JSON qw/decode_json/;
+use Mojo::Util qw/decode slurp/;
 use Mojo::Loader;
 use File::Basename;
 use Mojolicious;
@@ -47,8 +47,7 @@
 my $storage = $storage_class->new(config => $config->{Storage});
 
 foreach my $arg (@ARGV) {
-    my $json = Mojo::JSON->new();
-    my $pjson = $json->decode(slurp $arg);
+    my $pjson = decode_json(slurp $arg);
 
     my($filename, $dirs, $suffix) = fileparse($arg, qr/\.[^.]*/);
 
--- a/bin/gearman_decode_worker.pl	Tue Nov 11 21:35:24 2014 +0100
+++ b/bin/gearman_decode_worker.pl	Sun Jan 25 22:45:57 2015 +0100
@@ -16,8 +16,8 @@
 use Mojo::Base -strict;
 use lib 'lib';
 
-use Mojo::JSON;
-use Mojo::Util qw(decode slurp);
+use Mojo::JSON qw/decode_json/;
+use Mojo::Util qw/decode slurp/;
 use Mojo::Loader;
 use File::Temp;
 use Gearman::Worker;
@@ -47,8 +47,7 @@
 $worker->register_function("dump_decode", 60, sub {
     my $args = $_[0]->arg;
 
-    my $json = Mojo::JSON->new();
-    my $jsonin = $json->decode($args);
+    my $jsonin = decode_json($args);
 
     my $file = File::Temp->new();
     binmode($file);