From 11e14f5aadedb74e66c75f3baa44e4eb93dcf1c1 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Wed, 11 Sep 2013 09:03:14 -0700 Subject: [PATCH] [rt.cpan.org #88495] version->new str cmp bug MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We shouldn’t consider ver and version to be the same class. If ver inherits from version, ver->new should give a ver object. This string comparison bug has only ever existed in the perl core version of the version routines. It was ed1db70e1224 in 5.16 that introduced it. --- cpan/version/t/coretests.pm | 5 +++++ vxs.inc | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cpan/version/t/coretests.pm b/cpan/version/t/coretests.pm index 080b6ae..34b0181 100644 --- a/cpan/version/t/coretests.pm +++ b/cpan/version/t/coretests.pm @@ -576,6 +576,11 @@ SKIP: { is $v->numify, '0.520', 'Correctly nummified'; } + { # https://rt.cpan.org/Ticket/Display.html?id=88495 + @ver::ISA = "version"; + is ref(ver->new), 'ver', 'ver can inherit from version'; + } + } 1; diff --git a/vxs.inc b/vxs.inc index a8b9294..3217670 100644 --- a/vxs.inc +++ b/vxs.inc @@ -204,7 +204,8 @@ XS(XS_version_new) } rv = new_version(vs); - if ( strnNE(classname,"version", len) ) /* inherited new() */ + if ( len != 7 + || strnNE(classname,"version", len) ) /* inherited new() */ sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags)); mPUSHs(rv); -- 2.7.4