» about » content » twitter » github »

PerlTidy - Cleaning up Perl Code

Sometimes you have to work with the tangled mess that is someone else's Perl code. If that happens, I find the easiest way to make it readable is to run PerlTidy on it. Here's how I install and use it.

perl -MCPAN -e shell
cpan> install Perl::Tidy
cpan> exit
    

Once that's installed, you just run it like this:

perltidy yourscript.pl
    

In the above example, it'll create a cleaned-up script called yourscript.pl.tdy, if you're happy with that, you can replace the original.

There are many parameters you can use to modify the output.

© Roqet 2018 :: 2018-05-11 17:07:10