On Mon, Jan 12, 2004 at 11:24:04AM +0100, Steffen Müller wrote: > Now, I wonder whether it's possible to abuse Inline::C or > related modules to compile the generated C code at run-time and > wrap it into an anonymous subroutine. (Or a package subroutine > if that's the only problem.)
>From memory the function you'll need to compile code at runtime is named bind() I've no idea how easy it would be to get anonymous subroutines this way. You could cheat, by giving the generated C code incremental names, then taking a reference to the perl function and returning that. A quick test shows that undefining a subroutine has the annoying habit of invalidating any subroutine references you hold. Nicholas Clark