summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJohn Peacock <jpeacock@rowman.com>2002-10-14 18:36:48 -0400
committerhv <hv@crypt.org>2002-10-17 14:39:27 +0000
commit26ec6fc3972632211ff6621d98aed1b1df0d166d (patch)
treece58c63bf94d46bb90b2ffbcf9123e7823194270 /util.c
parent46314c133ffe2db9038a340b36533579af4603b9 (diff)
downloadperl-26ec6fc3972632211ff6621d98aed1b1df0d166d.tar.gz
Re: versions too accurate
Message-ID: <3DAB7F40.1050200@rowman.com> p4raw-id: //depot/perl@18027
Diffstat (limited to 'util.c')
-rw-r--r--util.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/util.c b/util.c
index 0fc7db5914..ed7ca66902 100644
--- a/util.c
+++ b/util.c
@@ -4082,14 +4082,23 @@ SV *
Perl_new_version(pTHX_ SV *ver)
{
SV *rv = NEWSV(92,5);
- char *version = (char *)SvPV(ver,PL_na);
-
+ char *version;
+ if ( SvNOK(ver) ) /* may get too much accuracy */
+ {
+ char tbuf[64];
+ sprintf(tbuf,"%.9"NVgf, SvNVX(ver));
+ version = savepv(tbuf);
+ }
#ifdef SvVOK
- if ( SvVOK(ver) ) { /* already a v-string */
+ else if ( SvVOK(ver) ) { /* already a v-string */
MAGIC* mg = mg_find(ver,PERL_MAGIC_vstring);
version = savepvn( (const char*)mg->mg_ptr,mg->mg_len );
}
#endif
+ else
+ {
+ version = (char *)SvPV(ver,PL_na);
+ }
version = scan_version(version,rv);
return rv;
}