Skip to content

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

@jimav

Description

@jimav

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions