]> granicus.if.org Git - pgbadger/commitdiff
Fix undefined subroutine encode_json when using -x json. Thanks to jason for the...
authorDarold Gilles <gilles@darold.net>
Mon, 3 Nov 2014 17:20:40 +0000 (18:20 +0100)
committerDarold Gilles <gilles@darold.net>
Mon, 3 Nov 2014 17:20:40 +0000 (18:20 +0100)
pgbadger

index 6a0fa0fb254f75bb850d5ed69d8487408b121d8f..acd23f0f86e5dc242a814cec7be460085c80ba62 100755 (executable)
--- 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