-
Notifications
You must be signed in to change notification settings - Fork 0
Perl tidy
Keeping code well formatted is not vital, however, it reduces the cost of maintenance and it raises acceptance among co-workers. Whenever someone looks into code snippets which vary all over the place the results are unpredictable. There are reasonable tools on the market which test your code and format it.
A common one is the Perl module Perl::Tidy. It lets 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 use the way the Mojolicious project formats the code?
-
Install Perl::Tidy (easiest way:
cpan Perl::Tidy) -
Download the perltidyrc file from the Mojolicious repo and install it inside your home directory.
perl -Mojo -e 'print g("http://github.com/kraih/mojo/raw/master/.perltidyrc")->body' \ > ~/.perltidyrc -
perltidywill use the default configuration file named~/.perltidyrcif no further options are given. You can use a differentperltidyrcfile using the command option-pro=<perltidyrc>. -
Format your sources (
perltidy <sourcefile>)