Subject: | Data::Dump causes an infinite loop with tied hashes in circular reference |
Date: | Sat, 16 Feb 2019 09:43:00 -0600 |
To: | <bug-Data-Dump [...] rt.cpan.org> |
From: | "Francisco Zarabozo" <paco [...] zarabozo.com> |
Hello,
The following code (tested in several different Perl versions) causes an
infinite loop in Data::Dump:
###################################
package NewStdHash;
require Tie::Hash;
@ISA = qw(Tie::StdHash);
package main;
use strict;
use warnings;
use Data::Dump 'dd';
my (%hash1, %hash2);
tie %hash1, 'NewStdHash';
tie %hash2, 'NewStdHash';
$hash1{name} = 'hash1';
$hash1{child} = \%hash2;
$hash2{name} = 'hash2';
$hash2{parent} = \%hash1;
print dd \%hash2;
###################################
If the two “tie” lines are commented out, then Data::Dump works correctly.
Any advice on how to resolve this?
Thanks in advance.
Best regards,
Francisco Zarabozo