Perl Tidy

Introduction
perltidy allows you to indent and reformat Perl scripts making them easier to read.

Installation
The installation is very simple and it's just like any other Perl module: cpan -i Perl::Tidy

Configuration
For simplicity, we insert all the parameterizations in a configuration file: echo ' -l=132  # maximum line length -i=4    # indent columns -lp     # line up parentheses -cti=1  # closing token indentation -pt=0   # paren tightness -sbt=0  # square bracket tightness -bt=0   # brace tightness -bbt=0  # block brace tightness -nolc   # prevent outdent long comments -bl     # opening brace on new line -vt=1   # vertical tightness -vtc=1  # vertical tightness closing -iob    # ignore old breakpoints ' > ~/.perltidyrc

To know the details of the many parameters available: man perltidy

Usage
If, for example, we want to beautify all files with a cgi extension in the current directory, creating a backup copy of the original files: perltidy -b *.cgi