Bleadperl to version 0.37
[p5sagit/p5-mst-13.2.git] / util.c
diff --git a/util.c b/util.c
index e2783b4..56dc800 100644 (file)
--- a/util.c
+++ b/util.c
@@ -3769,6 +3769,11 @@ Perl_scan_version(pTHX_ char *s, SV *rv, bool qv)
            }
        }
     }
+    if ( qv ) { /* quoted versions always become full version objects */
+       I32 len = av_len((AV *)sv);
+       for ( len = 2 - len; len != 0; len-- )
+           av_push((AV *)sv, newSViv(0));
+    }
     return s;
 }
 
@@ -3890,12 +3895,12 @@ Perl_vnumify(pTHX_ SV *vs)
 }
 
 /*
-=for apidoc vstringify
+=for apidoc vnormal
 
 Accepts a version object and returns the normalized string
 representation.  Call like:
 
-    sv = vstringify(rv);
+    sv = vnormal(rv);
 
 NOTE: you can pass either the object directly or the SV
 contained within the RV.
@@ -3904,7 +3909,7 @@ contained within the RV.
 */
 
 SV *
-Perl_vstringify(pTHX_ SV *vs)
+Perl_vnormal(pTHX_ SV *vs)
 {
     I32 i, len, digit;
     SV *sv = newSV(0);
@@ -3936,6 +3941,31 @@ Perl_vstringify(pTHX_ SV *vs)
 } 
 
 /*
+=for apidoc vstringify
+
+In order to maintain maximum compatibility with earlier versions
+of Perl, this function will return either the floating point
+notation or the multiple dotted notation, depending on whether
+the original version contained 1 or more dots, respectively
+
+=cut
+*/
+
+SV *
+Perl_vstringify(pTHX_ SV *vs)
+{
+    I32 i, len, digit;
+    if ( SvROK(vs) )
+       vs = SvRV(vs);
+    len = av_len((AV *)vs);
+    
+    if ( len < 2 )
+       return vnumify(vs);
+    else
+       return vnormal(vs);
+}
+
+/*
 =for apidoc vcmp
 
 Version object aware cmp.  Both operands must already have been