Subject: | doesn't handle circular references |
Hi there! First of all, great module!
I was browsing for ideas to integrate to Data::Printer and printing only
the skeleton of a data structure looks like a nice feature. Of course,
Data::Printer outputs text, so if one wants the actual data structure, I
want to point them at your module :)
One thing struck me, though: Data::Skeleton doesn't seem to be able to
handle circular references:
% perl -MData::Skeleton -e 'my $page = {}; $page->{circular} = $page; my
$s = Data::Skeleton->new; my $skel = $s->deflesh($page);'
Deep recursion on subroutine "Data::Skeleton::_blank_hash" at
/Users/garu/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/Data/Skeleton.pm
line 107.
The fix looks pretty straightforward: just keep track of each nested
reference (including the top level one) and don't enter it if you've
seen it already. The reason I haven't written it yet is because I'm not
sure if this is per design, or if you have other plans on how to handle
circular references.
Cheers!