-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
does not clone a partial of a constant
#25
Comments
Right now, it looks like another upstream bug in perl itself. Simply accessing the value inside Readonly::Clone(...) 'fixes' it. I'm trying to narrow it down to a minimal example that I can report but it looks like another bug I reported on perl's RT a few years ago. That one was related to ignored scalar magic while this one seems to be hash magic... I'd guess arrays will turn out to also be broken. I created a branch for this issue that shows that just accessing the variable can 'fix' this bug. If you comment out the line that dumps it and run your code example, the output is...
...notice that
...fixes everything. It correctly acknowledges that we're using references to a hash. Weird... trying to narrow it down. |
Take two! Got it down to a generic example that doesn't use Readonly.
...the output from this reads this way:
With the tied hash, we get a SCALAR reftype until we access any of the contents. Just dumping the structure is enough to wake perl's internals up to the tied magic. I'll have to report this upstream with our example once I do more testing. |
Reported as https://rt.perl.org/Ticket/Display.html?id=128588. Unfortunately, tie is kinda the redheaded stepchild of perl. I've had trouble with it ever since I took over Readonly and would rather throw all that classic code away. Smartmatch, select(), and now ref()... I hate bothering p5p for basically the same thing but a bug is a bug. :\ |
There is a workaround for this case:
|
Have you tried the drop-in replacement for Readonly I sent you about a month ago? https://metacpan.org/pod/ReadonlyX It isn't encumbered by tie. |
The text was updated successfully, but these errors were encountered: