From: Rafael Garcia-Suarez Date: Tue, 21 Jun 2005 09:40:46 +0000 (+0000) Subject: Fix [perl #36102] Data::Dumper Doesn't Stringify Numeric Labels X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d20128b88ca5cf7adb19e1f3382c9bfe14caba98;p=p5sagit%2Fp5-mst-13.2.git Fix [perl #36102] Data::Dumper Doesn't Stringify Numeric Labels p4raw-id: //depot/perl@24917 --- diff --git a/ext/Data/Dumper/Dumper.pm b/ext/Data/Dumper/Dumper.pm index 3d297c3..ef4da8a 100644 --- a/ext/Data/Dumper/Dumper.pm +++ b/ext/Data/Dumper/Dumper.pm @@ -9,7 +9,7 @@ package Data::Dumper; -$VERSION = '2.121_06'; +$VERSION = '2.121_07'; #$| = 1; diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs index 9fec64d..3db74ae 100644 --- a/ext/Data/Dumper/Dumper.xs +++ b/ext/Data/Dumper/Dumper.xs @@ -1041,12 +1041,15 @@ Data_Dumper_Dumpxs(href, ...) val = *svp; else val = &PL_sv_undef; - if ((svp = av_fetch(namesav, i, TRUE))) + if ((svp = av_fetch(namesav, i, TRUE))) { sv_setsv(name, *svp); + if (SvOK(*svp) && !SvPOK(*svp)) + (void)SvPV_nolen_const(name); + } else (void)SvOK_off(name); - if (SvOK(name)) { + if (SvPOK(name)) { if ((SvPVX_const(name))[0] == '*') { if (SvROK(val)) { switch (SvTYPE(SvRV(val))) { diff --git a/ext/Data/Dumper/t/dumper.t b/ext/Data/Dumper/t/dumper.t index 35b97b2..8ab5f1d 100755 --- a/ext/Data/Dumper/t/dumper.t +++ b/ext/Data/Dumper/t/dumper.t @@ -115,11 +115,11 @@ $WANT = <<'EOT'; # $a->[1]{'c'} # ]; #$b = $a->[1]; -#$c = $a->[1]{'c'}; +#$6 = $a->[1]{'c'}; EOT -TEST q(Data::Dumper->Dump([$a,$b,$c], [qw(a b c)])); -TEST q(Data::Dumper->Dumpxs([$a,$b,$c], [qw(a b c)])) if $XS; +TEST q(Data::Dumper->Dump([$a,$b,$c], [qw(a b), 6])); +TEST q(Data::Dumper->Dumpxs([$a,$b,$c], [qw(a b), 6])) if $XS; ############# 7