1
0
Fork 0
mirror of https://github.com/NixOS/hydra.git synced 2024-10-18 17:02:28 -04:00

(perlcritic) JSON::Any -> JSON::MaybeXS

This commit is contained in:
Graham Christensen 2021-09-07 21:52:43 -04:00
parent c603ae35f0
commit 85bb1c7ef9
3 changed files with 8 additions and 7 deletions

View file

@ -461,7 +461,7 @@
IOCompress IOCompress
IPCRun IPCRun
JSON JSON
JSONAny JSONMaybeXS
JSONXS JSONXS
LWP LWP
LWPProtocolHttps LWPProtocolHttps

View file

@ -8,7 +8,7 @@ use Hydra::Helper::Nix;
use Hydra::Helper::CatalystUtils; use Hydra::Helper::CatalystUtils;
use Hydra::Controller::Project; use Hydra::Controller::Project;
use JSON; use JSON;
use JSON::Any; use JSON::MaybeXS;
use DateTime; use DateTime;
use Digest::SHA qw(sha256_hex); use Digest::SHA qw(sha256_hex);
use Text::Diff; use Text::Diff;
@ -66,7 +66,7 @@ sub latestbuilds : Chained('api') PathPart('latestbuilds') Args(0) {
push @list, buildToHash($_) foreach @latest; push @list, buildToHash($_) foreach @latest;
$c->stash->{'plain'} = { $c->stash->{'plain'} = {
data => scalar (JSON::Any->objToJson(\@list)) data => scalar (encode_json(\@list))
}; };
$c->forward('Hydra::View::Plain'); $c->forward('Hydra::View::Plain');
} }
@ -107,7 +107,7 @@ sub jobsets : Chained('api') PathPart('jobsets') Args(0) {
push @list, jobsetToHash($_) foreach @jobsets; push @list, jobsetToHash($_) foreach @jobsets;
$c->stash->{'plain'} = { $c->stash->{'plain'} = {
data => scalar (JSON::Any->objToJson(\@list)) data => scalar (encode_json(\@list))
}; };
$c->forward('Hydra::View::Plain'); $c->forward('Hydra::View::Plain');
} }
@ -125,7 +125,7 @@ sub queue : Chained('api') PathPart('queue') Args(0) {
push @list, buildToHash($_) foreach @builds; push @list, buildToHash($_) foreach @builds;
$c->stash->{'plain'} = { $c->stash->{'plain'} = {
data => scalar (JSON::Any->objToJson(\@list)) data => scalar (encode_json(\@list))
}; };
$c->forward('Hydra::View::Plain'); $c->forward('Hydra::View::Plain');
} }
@ -169,7 +169,7 @@ sub nrbuilds : Chained('api') PathPart('nrbuilds') Args(0) {
@arr = reverse(@arr); @arr = reverse(@arr);
$c->stash->{'plain'} = { $c->stash->{'plain'} = {
data => scalar (JSON::Any->objToJson(\@arr)) data => scalar (encode_json(\@arr))
}; };
$c->forward('Hydra::View::Plain'); $c->forward('Hydra::View::Plain');
} }

View file

@ -6,6 +6,7 @@ use warnings;
use base 'Hydra::Base::Controller::ListBuilds'; use base 'Hydra::Base::Controller::ListBuilds';
use Hydra::Helper::Nix; use Hydra::Helper::Nix;
use Hydra::Helper::CatalystUtils; use Hydra::Helper::CatalystUtils;
use JSON::MaybeXS;
use Net::Prometheus; use Net::Prometheus;
sub job : Chained('/') PathPart('job') CaptureArgs(3) { sub job : Chained('/') PathPart('job') CaptureArgs(3) {
@ -50,7 +51,7 @@ sub shield :Chained('job') PathPart('shield') Args(0) {
$c->response->content_type('application/json'); $c->response->content_type('application/json');
$c->stash->{'plain'} = { $c->stash->{'plain'} = {
data => scalar (JSON::Any->objToJson( data => scalar (encode_json(
{ {
schemaVersion => 1, schemaVersion => 1,
label => "hydra build", label => "hydra build",