Subject: | Data::Dumper doesn't handle mutually recursive structures |
A test demonstrating the bug:
use Test::More tests => 1;
use Data::Dumper;
my $x = { };
my $y = { };
$x->{y} = $y;
$y->{x} = $x;
is_deeply(eval Dumper($x), $x, "round trip of mutually recursive structure");
the code emitted by data dumper should emit something like
$VAR1 = { };
$VAR2 = { x => $VAR1 };
$VAR1->{y} = $VAR2;
Ordered dependency tree resolution could help determine nodes which are dependent on each other, and allow this fix. It's pretty ugly though.