readonly
readonly copied to clipboard
Readonly::Clone should recurse past non-readonly top items
Currently the Clone deep-walkers abort the search if any non-tied variable is found. This makes cases like the following fail:
Readonly::Hash my %rodata => (topkey => [ {x=>1}, {x=>2}, {x=>3} ]);
my @dataset = @{ $rodata{topkey} };
my $aref = Readonly::Clone @dataset; # stops prematurely
$aref->[0]->{x] = "newvalue"; # "attempt to modify read-only data"
The _ARRAY and _HASH subs start with return if !tied(@$arg) etc. and I'm wondering if this is necessary. If they were allowed to continue to recurse, they would find read-only items deeper down.