Control: tag -1 patch

On Wed, Aug 07, 2024 at 01:01:52AM +0300, Niko Tyni wrote:
> Package: libdevel-confess-perl
> Version: 0.009004-3
> Severity: important
> Tags: trixie sid
> User: debian-p...@lists.debian.org
> Usertags: perl-5.40-transition
> 
> This package fails its autopkgtest checks with Perl 5.40 (currently
> in experimental.)

>  92s     # Name "Carp::CarpLevel" used only once: possible typo at 
> /usr/share/perl5/Devel/Confess/Source.pm line 23.

> A fix might be to add "no warnings 'once';" to the block where the
> offending variable is used.

Alternatively, as per perldiag.pod, "just mention it again somehow to
suppress the message."

Not sure which is cleaner, but the attached patch works for me.
-- 
Niko Tyni   nt...@debian.org
From: Niko Tyni <nt...@debian.org>
Date: Sun, 18 Aug 2024 19:52:15 +0100
X-Dgit-Generated: 0.009004-3 e6110ec318840ec5879ffa20f438ebb2bac657a1
Subject: Fix fatalized 'used only once' warnings

Starting with Perl 5.40, Perl actually honours
marking these warnings as fatal.

Bug-Debian: https://bugs.debian.org/1078102

---

diff --git a/lib/Devel/Confess/Source.pm b/lib/Devel/Confess/Source.pm
index 78893e4..1aca643 100644
--- a/lib/Devel/Confess/Source.pm
+++ b/lib/Devel/Confess/Source.pm
@@ -19,12 +19,14 @@ my $want_color = $^O ne 'MSWin32' ? 1 : eval {
 
 sub source_trace {
   my ($skip, $context, $evalonly) = @_;
+  $Carp::CarpLevel or 1; # silence a used-only-once warning
   $skip ||= 1;
   $skip += $Carp::CarpLevel;
   $context ||= 3;
   my $i = $skip;
   my @out;
   while (my ($pack, $file, $line) = (caller($i++))[0..2]) {
+    %Carp::Internal or %Carp::CarpInternal or 1; # silence a used-only-once warning
     next
       if $Carp::Internal{$pack} || $Carp::CarpInternal{$pack};
     next

Reply via email to