From: Niko Tyni <ntyni@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
Forwarded: https://rt.cpan.org/Ticket/Display.html?id=155114
Bug: https://rt.cpan.org/Ticket/Display.html?id=155114

---

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
