summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlaf Alders <olaf@wundersolutions.com>2024-08-07 15:06:31 -0400
committerOlaf Alders <olaf@wundersolutions.com>2024-08-07 15:06:31 -0400
commit5027701b08de97f7ddb6b5e695ba62d04231d504 (patch)
tree08d7f66cd16dd7d0a8643ddb3d35354c87a4c6f7
parent5b88333ea26119255964dde79d207df1ef548e49 (diff)
downloadPerlNavigator-5027701b08de97f7ddb6b5e695ba62d04231d504.zip
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.
-rw-r--r--server/src/perl/Inquisitor.pm5
1 files changed, 5 insertions, 0 deletions
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 {