From: Darold Gilles Date: Mon, 3 Nov 2014 17:20:40 +0000 (+0100) Subject: Fix undefined subroutine encode_json when using -x json. Thanks to jason for the... X-Git-Tag: v6.3~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=950626c370e438f0135313933d0abcbf2c388517;p=pgbadger Fix undefined subroutine encode_json when using -x json. Thanks to jason for the report. --- diff --git a/pgbadger b/pgbadger index 6a0fa0f..acd23f0 100755 --- a/pgbadger +++ b/pgbadger @@ -506,6 +506,12 @@ if (!$extension) { } else { $extension = 'html'; } +} elsif (lc($extension) eq 'json') { + if (eval {require JSON::XS;1;} ne 1) { + die("Can not save output in json format, please install Perl module JSON::XS first.\n"); + } else { + JSON::XS->import(); + } } # Set default filename of the output file