Skip to content
rhaen edited this page Oct 6, 2010 · 9 revisions

Perl::Tidy to the rescue

Keeping code well formatted is not vital, however, it reduces the cost of maintainance and it raises acceptance among co-workers. Whenever someone looks into code snippets which vary all over the place the results are unpredicatable. There are reasonable tools on the market which tests your code and formats it.

A common one is the Perl module Perl::Tidy. Perl::Tidy let's you specify the way your code is being formatted by using a configuration file named ~/.perltidyrc. The Mojolicious github repository has a nice perltidyrc included. Why not using the way the Mojolicious project format the code?

  • Install Perl::Tidy (easiest way: cpan Perl::Tidy)

  • Download the perltidyrc file from the Mojolicious repo (curl -O http://github.com/kraih/mojo/raw/master/.perltidyrc)

  • Move the .perltidyrc to your home or use the -pro=<perltidyrc> option

  • Format your sources (perltidy <sourcefile>)

Clone this wiki locally