>From 1cd69975f17a3e883690565032c94fcff39e504b Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Sun, 24 Aug 2025 17:56:49 +0100
Subject: [PATCH] Adapt to Scalar::Util change to use builtin:: functions where
 available

Starting with Scalar::Util 1.64 (bundled with Perl 5.42),
Scalar::Util::weaken() is really builtin::weaken() on newer Perls.

See https://github.com/Dual-Life/Scalar-List-Utils/pull/132
---
 t/coderefs.t | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/t/coderefs.t b/t/coderefs.t
index 2a9b4ed..d935243 100644
--- a/t/coderefs.t
+++ b/t/coderefs.t
@@ -472,7 +472,10 @@ sub blah { 42 }
     my $entry = $dir->live_objects->id_to_entry($sub_id);
 
     ok( !exists($entry->data->{file}), "XSUB detected" );
-    is_deeply( $entry->data, { package => "Scalar::Util", name => "weaken" }, "FQ reference only" );
+    # see https://github.com/Dual-Life/Scalar-List-Utils/pull/132
+    my $expected_package = ($] >= 5.040 and eval { Scalar::Util->VERSION("1.64") }) ?
+        'builtin': 'Scalar::Util';
+    is_deeply( $entry->data, { package => $expected_package, name => "weaken" }, "FQ reference only" );
 
     $dir->live_objects->clear;
 }
-- 
2.49.0

