[PATCH v2] get_maintainer: lazy load JSON::PP only when --json is used
From: Oleg Nesterov
Date: Fri Oct 30 2026 - 12:30:30 EST
After commit 09d8b39563e8 ("get_maintainer: add --json output mode"),
I can no longer use get_maintainer.pl; it fails at compile time if
JSON::PP is not installed even when --json is not requested.
This module is only needed with the --json option. Use "require" to
load this module dynamically inside the "if ($json)" block instead.
Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
---
scripts/get_maintainer.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 16b80a700d4a..b31b4016802f 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -21,7 +21,6 @@ use Cwd;
use File::Find;
use File::Spec::Functions;
use open qw(:std :encoding(UTF-8));
-use JSON::PP;
my $cur_path = fastgetcwd() . '/';
my $lk_path = "./";
@@ -663,6 +662,8 @@ my @maintainers = get_maintainers();
@bug = uniq(@bug) if ($bug);
if ($json) {
+ require JSON::PP;
+
my @json_maintainers;
for my $m (@maintainers) {
my ($addr, $role);
--
2.55.0