From: Gisle Aas Date: Tue, 5 Sep 2000 08:11:40 +0000 (+0200) Subject: Make Data::Dumper (non-XS) to work with changed semantics of ref(). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=54964f74243f54d078c7d7f57ff24310a7f5b499;p=p5sagit%2Fp5-mst-13.2.git Make Data::Dumper (non-XS) to work with changed semantics of ref(). Subject: Re: Undocumented(?) change to "ref" semantics in 5.7.0 Message-ID: p4raw-id: //depot/perl@7025 --- diff --git a/ext/Data/Dumper/Dumper.pm b/ext/Data/Dumper/Dumper.pm index 0ff48e6..a8e59ab 100644 --- a/ext/Data/Dumper/Dumper.pm +++ b/ext/Data/Dumper/Dumper.pm @@ -9,7 +9,7 @@ package Data::Dumper; -$VERSION = '2.101'; +$VERSION = '2.102'; #$| = 1; @@ -291,8 +291,7 @@ sub _dump { $s->{level}++; $ipad = $s->{xpad} x $s->{level}; - - if ($realtype eq 'SCALAR') { + if ($realtype eq 'SCALAR' || $realtype eq 'REF') { if ($realpack) { $out .= 'do{\\(my $o = ' . $s->_dump($$val, "\${$name}") . ')}'; } diff --git a/t/lib/dumper.t b/t/lib/dumper.t index 183442d..be9732f 100755 --- a/t/lib/dumper.t +++ b/t/lib/dumper.t @@ -262,11 +262,14 @@ EOT ## $WANT = <<'EOT'; #$VAR1 = { -# "abc\0'\efg" => "mno\0" +# "abc\0'\efg" => "mno\0", +# "reftest" => \\1 #}; EOT -$foo = { "abc\000\'\efg" => "mno\000" }; +$foo = { "abc\000\'\efg" => "mno\000", + "reftest" => \\1, + }; { local $Data::Dumper::Useqq = 1; TEST q(Dumper($foo)); @@ -274,7 +277,8 @@ $foo = { "abc\000\'\efg" => "mno\000" }; $WANT = <<"EOT"; #\$VAR1 = { -# 'abc\0\\'\efg' => 'mno\0' +# 'abc\0\\'\efg' => 'mno\0', +# 'reftest' => \\\\1 #}; EOT