I believe what you want would require some modifications to the highly experimental B::Bytecode. That module was originally intended to allow saving and later loading compiled versions of scripts or modules for efficiency. AIUI, it turned out that perl's code structure is so verbose (since it really wasn't designed with this in mind), that the costs to read in saved bytecode exceed what it takes to read and compile in the first place.
I'd encourage you to use Data::Dumper. It may not work on 100% of all code, but it's close (leaving aside issues of closures, which you would also have with bytecode), and when bugs are reported they do get fixed promptly. | [reply] |
Thanks for the interesting pointer, I guess this won't be solved gracefully until the advent of Perl6. I should have mentioned that I'm using Perl 5.6.1 on Debian stable, for which I'm sure B::Bytecode is not intended :)
Running the subroutine source through Data::Dumper is the plan for production, just my mind wouldn't let go of the idea since its quite easy in Python.
| [reply] |
B::Bytecode is a core module, and is included in 5.6.1.
| [reply] |
Er, but why do you *want* the bytecode?
| [reply] |