From 5027701b08de97f7ddb6b5e695ba62d04231d504 Mon Sep 17 00:00:00 2001 From: Olaf Alders Date: Wed, 7 Aug 2024 15:06:31 -0400 Subject: Fix warnings via namespace::autoclean On Perl 5.40 a new warning is introduced when the import method of an unknown package is called. https://perldoc.perl.org/perldelta#Calling-the-import-method-of-an-unknown-package-produces-a-warning This is seen via PerlNavigator because Inquisitor.pm removes namespace::clean and namespace::autoclean from %INC. The solution is to add stub import subs for these packages so that the Perl interpreter no longer believes that they do not exist. --- server/src/perl/Inquisitor.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/perl/Inquisitor.pm b/server/src/perl/Inquisitor.pm index 1638683..960f6f3 100644 --- a/server/src/perl/Inquisitor.pm +++ b/server/src/perl/Inquisitor.pm @@ -16,12 +16,17 @@ $SIG{__WARN__} = sub { warn '=PerlWarning=', @_ }; # These modules can cause issues because they wipe the symbol table before we get a chance to inspect it. # Prevent them from loading. # I hope this doesn't cause any issues, perhaps VERSION numbers or import statements would help here +# +# See https://perldoc.perl.org/perldelta#Calling-the-import-method-of-an-unknown-package-produces-a-warning +# for a discussion of why the stub imports are necessary as of Perl 5.40 $INC{'namespace/clean.pm'} = ''; $INC{'namespace/autoclean.pm'} = ''; { no strict 'refs'; *{'namespace::autoclean::VERSION'} = sub { '0.29' }; *{'namespace::clean::VERSION'} = sub { '0.27' }; + *{'namespace::autoclean::import'} = sub { }; + *{'namespace::clean::import'} = sub { }; } CHECK { -- cgit v1.2.3