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

Strange result from Readonly::Clone( scalar from Readonly::Scalar of hashref ) #30

Open
jimav opened this issue Nov 9, 2017 · 0 comments

Comments

@jimav
Copy link

jimav commented Nov 9, 2017

This may be cockpit error, but it seems to me that Readonly::Clone misbehaves when applied to a scalar which is a hashref:

my $original = { AA => [1..3], BB => { X => 5 }, };
my $ro; Readonly::Scalar $ro => $original;
my $rw = Readonly::Clone $ro;

The resulting $rw is not a mutable copy of $ro, but is a scalar ref to a READ-ONLY copy of $ro.

$rw = \{'AA' => [1,2,3],'BB' => {'X' => 5}};

I was expecting an exact mirror image of $rw, with everything below mutable.
I'll attach a demo script.

Readonlyscript.txt

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