in reply to create a CODE ref from a parse tree?
You might find perloptree and the B modules helpful, in particular B::Generate