On Tue, Apr 01, 2008 at 11:38:24PM -0400, wren argetlahm wrote: > Fair enough. I knew the optree stuff was hairy, though I didn't expect > it to be quite that hairy. If there aren't any hooks to apply > transformations prior to only having the opcodes, that severely limits > the options. For someone familiar with the Filter modules and familiar > enough with Perl to reinvent the grammars for the lexer/parser, that > could be another avenue for proof of concept and debugging. I forgot. Larry's MAD (Misc Attribute Decoration) which is in 5.10.0 (but described as "still in development") gives an XML dump of a program sufficient to recreate the source perfectly. I think that he's said that effectively it (or one of its post-processors) is able to create the AST for a Perl 5 program, despite no such thing really actually existing inside the perl interpreter at any point. That might be good enough to allow correct re-writing. But it sounds like it would not be trivial at all to it during the loading of a Perl source file from disk. To do it all in one sounds like it needs a source filter implementation that forks out to another perl running in MAD mode, feed your source file to that, then a post process on the output of MAD, and then feed *that* back in, in place of the file you first were reading. Nicholas ClarkThread Previous | Thread Next