Re: [PATCH] get_maintainer: lazy load JSON::PP only when --json is used
From: Sasha Levin
Date: Fri Oct 30 2026 - 18:19:28 EST
On Fri, Oct 30, 2026 at 10:44:03PM +0100, Oleg Nesterov wrote:
On 10/30, Joe Perches wrote:
Dunno. Depending on the current failure output
maybe adding something like the below is better:
use Module::Load::Conditional qw(check_install);
if (!check_install(module => 'JSON:PP')) {
die "$P: --json not available - missing perl module JSON:PP\n";
}
But why? Why make get_maintainer.pl depend on yet another module?
FYI, on my Fedora 44
$ perl -we 'use Module::Load::Conditional qw(check_install);'
Can't locate Module/Load/Conditional.pm in @INC (you may need to install the Module::Load::Conditional module) (@INC entries checked: /usr/local/lib64/perl5/5.42 /usr/local/share/perl5/5.42 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
And for what ???
If we want to "improve" the errmsg, we can use "eval { require JSON::PP; }; die ... if $@"
but this looks absolutely pointless to me.
Let me repeat. If JSON::PP is not installed, then get_maintainer.pl
with --json:
fails the same way before or after this patch, I see nothing to improve.
without --json:
fails before this patch, works after this patch
Sorry, I really can't understand your concerns.
I think that Oleg's change makes sense. The only reason I originally relied on
JSON::PP was because I was under the impression that it falls under the "pure
perl code" guidelines and gets autoinstalled with perl.
--
Thanks,
Sasha