Simon Cozens wrote in perl.fwp : > Randal L. Schwartz: > >> At the time >> I can possibly execute coderef2text, there *is* a current state. >> Deny that. > > OK, I'll deny that; B modules are typically executed during the CHECK > phase, when none of the code has been executed. At that time there is > no current state. OK?
Yes, but coderef2text is not executed when B::Deparse is loaded via O. In fact it's purely a wrapper around the subroutine deparser code, intended to be used at runtime, so Randal is correct (given his use case). >> coderef2text does not dump closures. I wish it would. It appears to >> be a hard problem. > > No, it's an absolutely trivial problem. B::Deparse::coderef2text appears not > to currently check the SVs defined in CvOUTSIDE as well as the current CV. If > it checked those SVs, you'd get what you wanted. It's probably only a three or > four line fix. Patches are very welcome. I can even supply you with a free > Perl 5 internals tutorial in case you're not up to speed on the issues > involved. More precisely coderef2text should set (optionally ? Hugo decides) a global flag "deparse closures with constants" that isn't set when B::Deparse is executed via O. I agree that this doesn't seem difficult to fix. I may have a look at it in the future, for some value of "future". (You know, when you discover something in perl that doesn't work as you think it should work, there's that perlbug thing in your $PATH.)