Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readonly::Clone should recurse past non-readonly top items #33

Open
jimav opened this issue Apr 30, 2018 · 0 comments
Open

Readonly::Clone should recurse past non-readonly top items #33

jimav opened this issue Apr 30, 2018 · 0 comments

Comments

@jimav
Copy link

jimav commented Apr 30, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant