From 9d4c0f0a9042678786ff58243b8fe91f8e90596e Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Sat, 23 Aug 2025 15:27:12 +0100
Subject: [PATCH] Adapt to ExtUtils::ParseXS changes in Perl 5.42

The bundled ExtUtils::ParseXS is a customized fork of an old upstream
version from 2007 or so. However, it still relies on the typemap file
bundled with Perl itself.

This typemap changed in Perl 5.41.1 with
  https://github.com/Perl/perl5/commit/42cf75238c3687c1b1fad9263614036f7059c2dc
so that double quote characters are no longer escaped.

This broke custom EU::ParseXS eval qq/"$expr;"/ style calls with code
interpolated from the typemap when generating code for the walk_stats()
function. The end result was that the callback argument in the function
never got set and the test suite failed with 'not a CODE reference'.

Work around this by using qq{} instead of "". Not sure if this is any
more robust, but it least it works with both Perl 5.40 and 5.42.


Bug-Debian: https://bugs.debian.org/1111915
Bug: https://github.com/timbunce/Memcached-libmemcached/pull/29
Forwarded: https://github.com/timbunce/Memcached-libmemcached/pull/29

---
 t/lib/ExtUtils/ParseXS.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/lib/ExtUtils/ParseXS.pm b/t/lib/ExtUtils/ParseXS.pm
index 401034d..642b785 100644
--- a/t/lib/ExtUtils/ParseXS.pm
+++ b/t/lib/ExtUtils/ParseXS.pm
@@ -1778,7 +1778,7 @@ sub generate_init {
       eval qq/print "\\t$var;\\n"/;
       warn $@   if  $@;
     }
-    $deferred{post_input} .= eval qq/"\\n$expr;\\n"/;
+    $deferred{post_input} .= eval qq/qq{\\n$expr;\\n}/;
     warn $@   if  $@;
   } else {
     die "panic: do not know how to handle this branch for function pointers"
-- 
2.49.0

