The XSUB.h patch from:
John Peacock [Wed, 18 Aug 2004 08:26:35 +0000 (04:26 -0400)]
Subject: CPAN Upload: J/JP/JPEACOCK/version-0.42.tar.gz
Message-ID: <41234AFB.1020009@rowman.com>

Now it will use version object logic for version comparison
when loading XS modules.

p4raw-id: //depot/perl@23323

XSUB.h

diff --git a/XSUB.h b/XSUB.h
index 4306454..c940d77 100644 (file)
--- a/XSUB.h
+++ b/XSUB.h
@@ -238,11 +238,17 @@ C<xsubpp>.  See L<perlxs/"The VERSIONCHECK: Keyword">.
                _sv = get_sv(Perl_form(aTHX_ "%s::%s", module,  \
                                    vn = "VERSION"), FALSE);            \
        }                                                               \
-       if (_sv && (!SvOK(_sv) || strNE(XS_VERSION, SvPV(_sv, n_a))))   \
-           Perl_croak(aTHX_ "%s object version %s does not match %s%s%s%s %"SVf,\
-                 module, XS_VERSION,                                   \
-                 vn ? "$" : "", vn ? module : "", vn ? "::" : "",      \
-                 vn ? vn : "bootstrap parameter", _sv);                \
+       if (_sv) {                                                      \
+           SV *xssv = Perl_newSVpvf(aTHX_ "%s",XS_VERSION);            \
+           xssv = new_version(xssv);                                   \
+           if ( !sv_derived_from(_sv, "version") )                     \
+               _sv = new_version(_sv);                         \
+           if ( vcmp(_sv,xssv) )                                       \
+               Perl_croak(aTHX_ "%s object version %_ does not match %s%s%s%s %_",\
+                     module, vstringify(xssv),                         \
+                     vn ? "$" : "", vn ? module : "", vn ? "::" : "",  \
+                     vn ? vn : "bootstrap parameter", vstringify(_sv));\
+       }                                                               \
     } STMT_END
 #else
 #  define XS_VERSION_BOOTCHECK