]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei sucks: don't warn or error out on missing dependencies
authorEric Wong <e@80x24.org>
Sun, 20 Jun 2021 04:33:19 +0000 (04:33 +0000)
committerEric Wong <e@80x24.org>
Sun, 20 Jun 2021 04:37:24 +0000 (04:37 +0000)
%INC can hold undef.  This can be hit on a Linux machine missing
Linux::Inotify2.  Loading PublicInbox::KQNotify is attempted and
PublicInbox/KQNotify.pm always exists, causing the `undef' entry
in %INC when it fails to load IO::KQueue.

$ perl -MData::Dumper -I lib \
-E 'eval { require PublicInbox::KQNotify }; say Dumper(\%INC)'

lib/PublicInbox/LeiSucks.pm

index a71158f36f03c97c9b3cdc8a0c0a96e8cbdd8c70..3e945d0b204dc53d7119947d31b09b479a95cf4e 100644 (file)
@@ -55,7 +55,7 @@ sub lei_sucks {
        my $dig = Digest::SHA->new(1);
        push @out, "public-inbox blob OIDs of loaded features:\n";
        for my $m (grep(m{^PublicInbox/}, sort keys %INC)) {
-               my $f = $INC{$m};
+               my $f = $INC{$m} // next; # lazy require failed (missing dep)
                $dig->add('blob '.(-s $f)."\0");
                $dig->addfile($f);
                push @out, '  '.$dig->hexdigest.' '.$m."\n";