Dump UVs as UVs in Data::Dumper.
Gurusamy Sarathy [Thu, 27 Apr 2000 12:26:25 +0000 (05:26 -0700)]
Subject: Re: [ID 20000405.018] Data::Dumper and negative numbers
Message-Id: <200004271926.MAA04331@molotok.activestate.com>

p4raw-id: //depot/perl@6494

ext/Data/Dumper/Dumper.xs

index bb606f4..6df47a5 100644 (file)
@@ -584,7 +584,10 @@ DD_dump(pTHX_ SV *val, char *name, STRLEN namelen, SV *retval, HV *seenhv,
 
        if (SvIOK(val)) {
             STRLEN len;
-            (void) sprintf(tmpbuf, "%"IVdf, SvIV(val));
+           if (SvIsUV(val))
+             (void) sprintf(tmpbuf, "%"UVdf, SvUV(val));
+           else
+             (void) sprintf(tmpbuf, "%"IVdf, SvIV(val));
             len = strlen(tmpbuf);
            sv_catpvn(retval, tmpbuf, len);
        }