On Wed, Aug 07, 2024 at 11:14:53AM +0300, Niko Tyni wrote:
> Package: libuniversal-exports-perl
> Version: 0.05-4
> Severity: important
> Tags: trixie sid
> User: [email protected]
> Usertags: perl-5.40-transition
> 
> This module warns on usage with Perl 5.40 (currently in experimental).
> This causes an autopkgtest regression.
> 
>   
> https://ci.debian.net/packages/libu/libuniversal-exports-perl/unstable/amd64/50046521/
> 
>   $ perl -e 'use UNIVERSAL::exports'
>   Subroutine UNIVERSAL::import redefined at /usr/share/perl5/Exporter/Lite.pm 
> line 56.
> 
> Apparently UNIVERSAL has started to define an 'import' method, as mentioned in
> 
>   
> https://metacpan.org/dist/perl/view/pod/perldelta.pod#Calling-the-import-method-of-an-unknown-package-produces-a-warning

The attached patch seems to fix this, but I feel dirty to suggest it.
OTOH any fiddling with UNIVERSAL feels dirty to me, so *shrug*.

I'm tempted to say UNIVERSAL-exports should just go away, but there's
a handful of packages depending on it.

Perhaps just whitelist the warning for our QA and let users of the
reverse dependencies suffer?

  % apt-cache rdepends libuniversal-exports-perl
  libuniversal-exports-perl
  Reverse Depends:
    libclass-dbi-plugin-pager-perl
    libuniversal-require-perl
    libtemplate-plugin-clickable-perl
    libmodule-pluggable-fast-perl
    libformvalidator-simple-perl

-- 
Niko
>From d51f37feed4c2c31bcc2a6496c356e741e51b9a0 Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Sat, 24 Aug 2024 17:14:41 +0100
Subject: [PATCH] Silence "UNIVERSAL::import redefined" warning with Perl 5.40

UNIVERSAL gained an import method in newer perls to be able
to catch errors calling undefined import methods. See

  https://metacpan.org/dist/perl/view/pod/perldelta.pod#Calling-the-import-method-of-an-unknown-package-produces-a-warning

Unfortunately this makes 'use UNIVERSAL::exports' issue a
redefine warning.

This is the only way I found to disable this warning, but
it does feel dirty.

Bug-Debian: https://bugs.debian.org/1078118
---
 lib/UNIVERSAL/exports.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/UNIVERSAL/exports.pm b/lib/UNIVERSAL/exports.pm
index ef93276..0b7059d 100644
--- a/lib/UNIVERSAL/exports.pm
+++ b/lib/UNIVERSAL/exports.pm
@@ -5,7 +5,11 @@ $UNIVERSAL::exports::VERSION = '0.05';
 package UNIVERSAL;
 
 use strict;
-use Exporter::Lite qw(import);
+BEGIN {
+    require Exporter::Lite;
+    undef *UNIVERSAL::import;
+    Exporter::Lite->import(qw(import));
+}
 
 =head1 NAME
 
-- 
2.45.2

Reply via email to