Perltidy 20060719 reviewDownload
Perltidy is a Perl script which indents and reformats Perl scripts to make them easier to read
Perltidy is a Perl script which indents and reformats Perl scripts to make them easier to read. If you write Perl scripts, or spend much time reading them, you will probably find it useful.
While style preferences vary, most people would agree that it is important to maintain a uniform style within a script, and this is a major benefit provided by perltidy. Once you have decided on which, if any, special options you prefer, you may want to avoid having to enter them each time you run it. You can do this by creating a special file named .perltidyrc in either your home directory, your current directory, or certain system-dependent locations. (Note the leading ``.'' in the file name).
A handy command to know when you start using a configuration file is
which will dump to standard output the search that perltidy makes when looking for a configuration file, and the contents of the one that it selects, if any. This is one of a number of useful ``dump and die'' commands, in which perltidy will dump some information to standard output and then immediately exit. Others include -h, which dumps help information, and -v, which dumps the version number.
Another useful command when working with configuration files is
which causes the contents of file to be used as the configuration file instead of a .perltidyrc file. With this command, you can easily switch among several different candidate configuration files during testing.
This .perltidyrc file is free format. It is simply a list of parameters, just as they would be entered on a command line. Any number of lines may be used, with any number of parameters per line, although it may be easiest to read with one parameter per line. Blank lines are ignored, and text after a '#' is ignored to the end of a line.
Here is an example of a .perltidyrc file:
This is a simple of a .perltidyrc configuration file
This implements a highly spaced style
-bl # braces on new lines
-pt=0 # parens not tight at all
-bt=0 # braces not tight
-sbt=0 # square brackets not tight
If you experiment with this file, remember that it is in your directory, since if you are running on a Unix system, files beginning with a ``.'' are normally hidden.
If you have a .perltidyrc file, and want perltidy to ignore it, use the -npro flag on the command line.
Perltidy is programmed to work with versions of Perl as old as 5.004. (You can find your version with perl -v). However, some systems this old may have problems, particularly Windows versions.
This this release was successfully tested on a 5.004_04 linux distribution (1997) and a 5.005_03 Windows version (ActiveState build 522, 1999).
The following modules are not required, but perltidy may use them if detected:
Win32 will be used to help identify a Windows system if detected
HTML::Entities will be used to encode HTML entities if detected
Pod::Html will be used to format pod text
The total disk space needed after removing the installation directory will about 1 Mb.
For most standard installations, the standard Makefile.PL method should work:
The INSTALL file has additional installation notes.
What's New in This Release:
This release improves vertical alignment of terminal else blocks and ternary statements.
It also eliminates a bug where a here-doc invoked through an "e" modifier on a pattern replacement text was not recognized.
Perltidy 20060719 keywords