At $work, I've been writing scripts that use PPI to munge massive amounts
of legacy code. So far simple things like changing die/warn to croak/carp,
ensuring all modules specify a minimum version number, or changing print
"foo\n" so say "foo", etc. It seems worthy enough to turn this code into a
CPAN module.

My thoughts are that it would use a plugin system for specific tasks, and a
command-line script that takes plugin names as arguments, so basically
you'd run the script to apply various tasks to a set of modules or scripts
in a directory, perhaps using a configuration file for each of the plugins.

The early version would have simple plugins, but there's no reason why more
complex plugins couldn't be written (e.g. to translate a non-Moose  class
into something Moose-like), or other things like optimize certain kinds of
expressions.

I'm well aware of the limitations of doing this automatically. But the idea
is to get a script that can do the bulk of the tedious rewriting, so that a
human can clean up the mistakes. It's meant to be run by intelligent people
who use things like version control and tests.

So what should it be called? I'm thinking Perl::Rewrite is the best name.

> Alternatives are:
> - Perl::Refactor - except "refactoring" has a technical meaning that I
don't think applies
> - Perl::Modernize - except that one might want a plugin that translates
newer-style code into older code
> - Perl::Munge - except that it connotes sloppiness
> - Perl::Snorft - no, just kidding.... I have no idea what that means.
> - ?

Thanks,
Rob

Reply via email to