On Tue, 10 Jan 2006, Paul Johnson wrote: > > Since lexical variables don't appear in the symbol table, the only way I > > know of to access it from XS would be to stash a reference somewhere and > > pass that to the XS routine. > > You could take a look at the code in PadWalker on CPAN to get some > ideas, I think.
Oooooh. Cute. Thanks for the pointer to that! > > Also, I may have simply been up too long, > > but I don't believe your example represents a closure. Only (1) instance > > of 'mysub' will exist and it's present in the package's symbol table. > > The docs (used to?) talk about closures being anonymous subroutines, but > I think most people nowadays would says that mysub closes over $variable > and hence it is a closure. Yup, too long a day... Agreed. Steve