diff options
author | John Peacock <jpeacock@rowman.com> | 2004-04-06 17:56:19 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-04-07 08:00:07 +0000 |
commit | b9381830ea61ec067aab6d500e359e6a80e285b6 (patch) | |
tree | 00bd740237c0cd7f92b34436e00b3abc25ff339f /util.c | |
parent | e3c9a8b9e0e8ab67833a50cc3f37939286b04437 (diff) | |
download | perl-b9381830ea61ec067aab6d500e359e6a80e285b6.tar.gz |
Bleadperl to version 0.37
Message-ID: <40735FC3.5010305@rowman.com>
p4raw-id: //depot/perl@22668
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 36 |
1 files changed, 33 insertions, 3 deletions
@@ -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 |