From c14ab9f61796841cde5a36f0587fff886ae5b6a2 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 3 Jul 2015 13:24:37 +0200 Subject: [PATCH] Stop using the OO Mojo::JSON interface as it's deprecated and removed from Mojolicious 6 --- vroom.pl | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/vroom.pl b/vroom.pl index d1d8682..5ab51dc 100755 --- a/vroom.pl +++ b/vroom.pl @@ -1412,15 +1412,13 @@ any '/api' => sub { my $self = shift; $self->purge_api_keys; my $token = $self->req->headers->header('X-VROOM-API-Key'); - my $json = Mojo::JSON->new; - my $req = $json->decode($self->param('req')); - my $err = $json->error; + my $req = Mojo::JSON::decode_json($self->param('req')); my $room; - if ($err || !$req->{action} || !$req->{param}){ + if (!$req->{action} || !$req->{param}){ return $self->render( json => { - msg => $err, - err => $err + msg => $self->l('ERROR_OCCURRED'), + err => 'ERROR_OCCURRED' }, status => 503 ); @@ -1664,10 +1662,10 @@ any '/api' => sub { $room->{max_members} = $req->{param}->{max_members}; # Room persistence can only be set by admins if ($req->{param}->{persistent} ne '' && $self->key_can_do_this(token => $token, action => 'set_persistent')){ - $room->{persistent} = ($req->{param}->{persistent} eq Mojo::JSON->true) ? '1' : '0'; + $room->{persistent} = ($req->{param}->{persistent} eq Mojo::JSON::true) ? '1' : '0'; } foreach my $pass (qw/join_password owner_password/){ - if ($req->{param}->{$pass} eq Mojo::JSON->false){ + if ($req->{param}->{$pass} eq Mojo::JSON::false){ $room->{$pass} = undef; } elsif ($req->{param}->{$pass} ne ''){