diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-08-05 01:05:45 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-08-05 16:02:01 -0700 |
commit | f32c7e864b6210c7dabe6a78f842c37aa73c56c3 (patch) | |
tree | b6a222fda29c83ac85ef9cdd7a423c31907b3578 /cop.h | |
parent | bb02a38febc60a289c616282d720015be97842a4 (diff) | |
download | perl-f32c7e864b6210c7dabe6a78f842c37aa73c56c3.tar.gz |
Recursive formats and closures in formats.
Formats called recursively were using the same set of lexicals, so the
inner call would stomp on the outer calls vars, usually clearing them
when exiting.
Previous commits prepared a CvDEPTH field for formats. This commit
sets it in P(USH|OP)FORMAT and pushes a new pad in enterwrite.
This also allows closures to work properly in formats. Formerly they
caused assertion failures in cv_clone. Now cv_clone’s assumptions
about CvDEPTH on CvOUTSIDE and find_runcv are met when subs are embed-
ded in formats.
Diffstat (limited to 'cop.h')
-rw-r--r-- | cop.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -627,6 +627,7 @@ struct block_format { cx->blk_format.gv = gv; \ cx->blk_format.retop = (retop); \ cx->blk_format.dfoutgv = PL_defoutgv; \ + CvDEPTH(cv)++; \ SvREFCNT_inc_void(cx->blk_format.dfoutgv) #define POP_SAVEARRAY() \ @@ -679,6 +680,7 @@ struct block_format { #define POPFORMAT(cx) \ setdefout(cx->blk_format.dfoutgv); \ + CvDEPTH(cx->blk_format.cv)--; \ SvREFCNT_dec(cx->blk_format.dfoutgv); /* eval context */ |