This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[rt.cpan.org #88495] bad string comparison in version->qv
authorFather Chrysostomos <sprout@cpan.org>
Wed, 11 Sep 2013 20:10:15 +0000 (13:10 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 4 Jan 2014 13:10:03 +0000 (05:10 -0800)
qv is affected, too.  A package called "ver" inheriting from version
should be able to create "ver" objects via ->qv.

cpan/version/t/coretests.pm
vxs.inc

index 34b0181..7ece45b 100644 (file)
@@ -579,6 +579,7 @@ SKIP: {
     { # https://rt.cpan.org/Ticket/Display.html?id=88495
        @ver::ISA = "version";
        is ref(ver->new), 'ver', 'ver can inherit from version';
+       is ref(ver->qv("1.2.3")), 'ver', 'ver can inherit from version';
     }
 
 }
diff --git a/vxs.inc b/vxs.inc
index 56b8902..b239fad 100644 (file)
--- a/vxs.inc
+++ b/vxs.inc
@@ -436,8 +436,8 @@ XS(XS_version_qv)
        } else {
            rv = sv_2mortal(new_version(ver));
        }
-       if ( items == 2
-                && strnNE(classname,"version", len) ) { /* inherited new() */
+       if ( items == 2 && (len != 7
+               || strnNE(classname,"version", len)) ) { /* inherited new() */
            sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags));
         }
        PUSHs(rv);