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 <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2022-05-11 14:26:06 +00:00 committed by Tomas Cohen Arazi
parent 2265739a37
commit da1115336b
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 6 additions and 4 deletions

View File

@ -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 {