PPIX::Refactor
(Moved from reddit.com/r/perl now that blogs.perl.org seems to be behaving itself).
Over the past year or so I've had to deal with PPI for parsing and rewriting perl code a handful of times. Refactoring scripts are generally one-shot single purpose. Like any data mangling activity refactoring scripts can get messy because they're generally disposable, so architecture tends to be an afterthought at best. You can kind of tell this if you go and read Perl::Critic policies. They're plagued by boilerplate and repetitive code, and that's for code that is extensively reused. The problem multiplies in the case where you're writing throwaway code against PPI. In this post I'm going to show off PPIx::Refactor, which is a minimal interface to contain a small but annoying part of the mess.