From da1115336bfab44eb9eebaae214c355fa19fc36d Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 11 May 2022 14:26:06 +0000 Subject: [PATCH] Bug 30731: Silence noisy CPAN modules in C4::Installer::PerlModules Main change is replacing 'no warnings' by local $SIG{__WARN__}. The modules are sorted now too. This will make results of requiring them one after the other a more predictable experience and improves the output of koha_perl_deps. Test plan: Run about. Check plack intranet log. Run koha_perl_deps.pl -a Signed-off-by: Marcel de Rooy Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- C4/Installer/PerlModules.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/C4/Installer/PerlModules.pm b/C4/Installer/PerlModules.pm index f143bc6cc1..a66dc03899 100644 --- a/C4/Installer/PerlModules.pm +++ b/C4/Installer/PerlModules.pm @@ -54,9 +54,7 @@ sub versions_info { foreach my $phase ($self->prereqs->phases) { foreach my $type ($self->prereqs->types_in($phase)) { my $reqs = $self->prereqs->requirements_for($phase, $type); - foreach my $module ($reqs->required_modules) { - no warnings; # perl throws warns for invalid $VERSION numbers which some modules use - + foreach my $module (sort $reqs->required_modules) { my $module_infos = { cur_ver => 0, required => $type eq 'requires', @@ -76,7 +74,11 @@ sub versions_info { my $attr; $Readonly::XS::MAGIC_COOKIE="Do NOT use or require Readonly::XS unless you're me."; - eval "require $module"; + { + # ignore warnings from noisy modules + local $SIG{__WARN__} = sub {}; + eval "require $module"; + } if ($@) { $attr = 'missing_pm'; } else { -- 2.39.5