Subject: | Reference which equal undef is cloned incorrectly |
code with Clone::Fast
===
use Data::Dumper;
use Clone::Fast;
$a->{b} = [];
# $a->{b} is link to array
$a->{b} = undef;
# $a->{b} is still link to array, but undefined
$b = Clone::Fast::clone($a);
$a->{b} = 123;
# and now $a->{b} != $b->{b}, wrong
print Dumper($a);
print Dumper($b);
===
code with Clone;
===
use Data::Dumper;
use Clone;
$a->{b} = [];
# $a->{b} is link to array
$a->{b} = undef;
# $a->{b} is still link to array, but undefined
$b = Clone::clone($a);
$a->{b} = 123;
# and now $a->{b} != $b->{b}, correct
print Dumper($a);
print Dumper($b);
===