I do not understand why the output here claims to have seen repeated values like var[0][0]. I don't see this behaviour without the custom _data_printer method (tested both with and without my own .dataprinter settings).
% $PERL -v | grep version
This is perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-linux
% $PERL -MDDP -E 'say $Data::Printer::VERSION'
1.002001
% cat t1
# simplified from real-world example
use strict;
use warnings;
use DDP;
my $list = [
map [ map Obj->new($_), @$_ ], (
[ { data => { a => 1 } }, { data => { b => 2 } } ],
[ { data => { c => 3 } }, { data => { d => 4 } } ],
),
];
p $list;
package Obj {
sub new {
my($class, $data) = @_;
bless $data, $class;
}
sub _data_printer {
my($self, $ddp) = @_;
my %subdata = %{ $self->{data} };
return $ddp->parse(\%subdata);
}
};
% $PERL t1
[
[
{
a => 1
},
{
b => var[0][0]
}
],
[
{
c => 3
},
{
d => var[1][0]
}
]
]
I do not understand why the output here claims to have seen repeated values like
var[0][0]. I don't see this behaviour without the custom_data_printermethod (tested both with and without my own.dataprintersettings).