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
reset() silently fails to reset some variables like $1, $^W #20763
Comments
Yeah, those are variables that are lazily initialized (in |
I wouldn't expect reset to change $1 and other regex vars, they aren't writable, so arguably there is nothing to reset. We don't have a variable that represent PL_curpm currently, and the regexp vars are essentially ties that expose the state of PL_curpm. |
The problem with gv_magicalize() is called for each of the names during compilation before the reset is called, e.g, from debugging the
If I modify sv_resetpvn() to call set magic, we get more reasonable (if noisy) results:
Note that Similarly with the uninitialized value warnings: one for |
reset() with an argument would clear the specified SVs when requested but didn't call set magic, this would result in the effect on magic variables not applying, such as the $| and $^W used in the ticket. This isn't a problem for AVs and HVs as their corresponding clear functions do call the appropriate clear magic. Fixes Perl#20763
reset() with an argument would clear the specified SVs when requested but didn't call set magic, this would result in the effect on magic variables not applying, such as the $| and $^W used in the ticket. This isn't a problem for AVs and HVs as their corresponding clear functions do call the appropriate clear magic. Fixes #20763
reset() with an argument would clear the specified SVs when requested but didn't call set magic, this would result in the effect on magic variables not applying, such as the $| and $^W used in the ticket. This isn't a problem for AVs and HVs as their corresponding clear functions do call the appropriate clear magic. Fixes Perl#20763
Description
reset()
works with some core variables (e.g.$0
,$^X
), but not others (e.g.$|
,$1
,$^W
).Steps to Reproduce
Expected behavior
I would've expected all of these variables to be reset to
undef
, or if that's not possible (eyeing$|
in particular), an error or warning to be generated.Perl configuration
The text was updated successfully, but these errors were encountered: