Subject: | Missing symbol on perl < 5.8.8 |
2.017 introduced the following change to croak_sv: https://metacpan.org/diff/file?target=PEVANS/Socket-2.017/&source=PEVANS/Socket-2.016/#Socket.xs
For one cpan lists SvPVx as "undocumented":
https://metacpan.org/diff/file?target=GRAY/POSIX-RT-Spawn-0.10/&source=GRAY/POSIX-RT-Spawn-0.09/#Changes
and
https://metacpan.org/diff/file?target=SHLOMIF/XML-LibXML-1.86/&source=SHLOMIF/XML-LibXML-1.85/#Changes
Moreover there seems to be very little use of SvPVx_nolen in the wild: http://grep.cpan.me/?q=%5CbSvPVx_nolen%5Cb
Nevertheless attached a patch (modeled on https://metacpan.org/source/MHX/Convert-Binary-C-0.76/tests/include/perlinc/sv.h#L1594)
Tested all the way down to 5.8.1 on linux, with no adverse effects.
Subject: | SvPVx_nolen.patch.txt |
diff --git a/Socket.xs b/Socket.xs
index 9595652..50a0f31 100644
--- a/Socket.xs
+++ b/Socket.xs
@@ -149,6 +149,14 @@ NETINET_DEFINE_CONTEXT
# define Newx(v,n,t) New(0,v,n,t)
#endif /* !Newx */
+#ifndef SvPVx_nolen
+#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
+# define SvPVx_nolen(sv) ({SV *_sv = (sv); SvPV_nolen(_sv); })
+#else /* __GNUC__ */
+# define SvPVx_nolen(sv) ((PL_Sv = (sv)), SvPV_nolen(PL_Sv))
+#endif /* __GNU__ */
+#endif /* !SvPVx_nolen */
+
#ifndef croak_sv
# define croak_sv(sv) croak(SvPVx_nolen(sv))
#endif