diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-08-31 22:44:57 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-09-01 06:20:48 -0700 |
commit | 9da346da98617273964d333ee33ca5cdbddae4a1 (patch) | |
tree | a4870ef2ca4ef8a9e1f6ce9456aaf9175e8447d0 /pp.h | |
parent | 7d953ba8a0841912423af9b3e7d1daef726d5fb0 (diff) | |
download | perl-9da346da98617273964d333ee33ca5cdbddae4a1.tar.gz |
[perl #97484] Make defined &{...} vivify CORE subs
Magical variables usually get autovivified, even in rvalue context,
because Perl is trying to pretend they have been there all along.
That means defined(${"."}) will autovivify $. and return true.
Until CORE subs were introduced, there were no subroutines that popped
into existence when looked at.
This commit makes rv_2cv use the GV_ADDMG flag added in commit
23496c6ea. When this flag is passed, gv_fetchpvn_flags creates a GV
but does not add it to the stash until it finds out that it is creat-
ing a magical one. The CORE sub code calls newATTRSUB, which expects
to add the CV to the stash itself. So the gv has to be added there
and then. So gv_fetchpvn_flags is also adjusted to add the gv to the
stash right before calling newATTRSUB, and to tell itself that the
GV_ADDMG flag is actually off.
It might be better to move the CV-creation code into op.c and inline
parts of newATTRSUB, to avoid fiddling with the addmg variable (and
avoid prototype checks on CORE subs), but that refactoring should
probably come in separate commits.
Diffstat (limited to 'pp.h')
0 files changed, 0 insertions, 0 deletions