Make formats close over the right closure
authorFather Chrysostomos <sprout@cpan.org>
Fri, 29 Jun 2012 07:50:30 +0000 (00:50 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 29 Jun 2012 07:51:10 +0000 (00:51 -0700)
commit70794f7b4fe6d2c8f69493d55274dba5e4a20f91
treeca7d8a3686283b1c5bcf9ca926c631da1782fd59
parent5dff782da0fedb2c813f8a63e1a8df588bb6159e
Make formats close over the right closure

This was brought up in ticket #113812.

Formats that are nested inside closures only work if invoked from
directly inside that closure.  Calling the format from an inner sub
call won’t work.

Commit af41786fe57 stopped it from crashing, making it work as well
as 5.8, in that closed-over variables would be undefined, being
unavailable.

This commit adds a variation of the find_runcv function that can check
whether CvROOT matches an argument passed in.  So we look not for the
current sub, but for the topmost sub on the call stack that is a clone
of the closure prototype that the format’s CvOUTSIDE field points to.
embed.fnc
embed.h
pad.c
pp.h
pp_ctl.c
proto.h
t/comp/form_scope.t