diff options
author | Vincent Pit <perl@profvince.com> | 2010-06-03 11:44:15 +0200 |
---|---|---|
committer | Vincent Pit <perl@profvince.com> | 2010-06-03 14:00:38 +0200 |
commit | 789bd863840ef4ff6c46f7c2ee0f3f64e0b5daa6 (patch) | |
tree | 547efad230cfa3f03e5c971600e394627beb62f3 /pad.c | |
parent | 540810e8986e170e75f4b34a7ca1f1dd5b0da3c4 (diff) | |
download | perl-789bd863840ef4ff6c46f7c2ee0f3f64e0b5daa6.tar.gz |
Make pp_reverse fetch the lexical $_ from the correct pad
This is achieved by introducing a new find_rundefsv() function in pad.c
This fixes [perl #75436].
Diffstat (limited to 'pad.c')
-rw-r--r-- | pad.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -704,6 +704,28 @@ Perl_find_rundefsvoffset(pTHX) } /* + * Returns a lexical $_, if there is one, at run time ; or the global one + * otherwise. + */ + +SV * +Perl_find_rundefsv(pTHX) +{ + SV *namesv; + int flags; + PADOFFSET po; + + po = pad_findlex("$_", find_runcv(NULL), PL_curcop->cop_seq, 1, + NULL, &namesv, &flags); + + if (po == NOT_IN_PAD + || (SvFLAGS(namesv) & (SVpad_NAME|SVpad_OUR)) == (SVpad_NAME|SVpad_OUR)) + return DEFSV; + + return PAD_SVl(po); +} + +/* =for apidoc pad_findlex Find a named lexical anywhere in a chain of nested pads. Add fake entries |