-
Notifications
You must be signed in to change notification settings - Fork 1
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
unset is not setting the magic #1
Comments
Outside of some special cases, magic is not copied across assignments. |
Oh! Duh. Don't I feel stupid. Working on a project with magic now and that should have been dead obvious to me. Originally I had sub something ($self, $new = unset) {
if ( is_set($new) ) {
$self->{something} = $new;
}
else {
return $self->{something};
}
} Any pointers on where I can read those special cases? |
Or is there some way the code can know what it's been assigned to and attach magic to that? (I assume the answer is "no") |
The special case is tainting, and it's very special and widely hated. |
vstring magic is the only one that "copies" across assignment, and it has special handling in |
I almost got it to work using the vstring approach, but the magic vtable doesn't get copied along so it doesn't quite work. A one-line fix in core probably would make this possible (but should it?) |
@Leont What is the one-line fix, what does it do, and what would the impact be? Would it allow for more things like this to be possible? |
this Though in reality it's probably a bit more complicated as this path is only taken by |
@Leont Yeah, they would need to be undefined. Setting them to any value, even |
On my Mac, I'm getting the following error when I run
make test
:Somehow, the magic is not getting set when I do this:
The text was updated successfully, but these errors were encountered: