Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  TEST::PERLTIDY (3)

.ds Aq ’


Test::PerlTidy - check that all your files are tidy.



    # In a file like t/perltidy.t:

    use Test::PerlTidy;



This rather unflattering comment was made in a piece by Ken Arnold:

    "Perl is a vast swamp of lexical and syntactic swill and nobody
    knows how to format even their own code well, but its the only
    major language I can think of (with the possible exception of the
    recent, yet very Java-like C#) that doesnt have at least one
    style thats good enough."

Hmmm... He is sort of right in a way. Then again the piece he wrote was related to Python which is somewhat strict about formatting itself.

Fear not though - now you too can have your very own formatting gestapo in the form of Test::PerlTidy! Simply add a test file as suggested above and any file ending in .pl, .pm, .t or .PL will cause a test fail unless it is exactly as perltidy would like it to be.


If the style is mandated in tests then it will be adhered to.

If perltidy decides what is a good style then there should be no quibbling.

If the style never changes then cvs diffs stop catching changes that are not really there.

Readability might even improve.


If you want to change the default style then muck around with ’.perltidyrc’;

To quickly make a file work then try ’perltidy -b’.


Runs <B>perltidyB> on files and reports errors if any of the files differ after having been tidied. Does not permanently modify the files being tested.

By default, <B>perltidyB> will be run on files under the current directory and its subdirectories with extensions matching: .pm .pl .PL .t


run_tests ( [ CI%args ] )

This is the main entry point for running tests.

A number of options can be specified when running the tests, e.g.:

              path       => $start_dir,
              perltidyrc => $path_to_config_file,
              exclude    => [ qr{\.t$}, inc/],

debug Set debug to a true value to enable additional diagnostic output, in particular info about any processing done as a result of specifying the exclude option. Default is false.
exclude run_tests() will look for files to test under the current directory and its subdirectories. By default, it will exclude files in the "./blib/" directory. Set exclude to a listref of exclusion criteria if you need to specify additional rules by which files will be excluded.

If an item in the exclude list is a string, e.g. "./blib/", it will be assumed to be a path prefix. Files will be excluded if that string matches their path at the beginning.

If an item in the exclude list is a regex object, e.g. "qr{\.t$}", files will be excluded if that regex matches their path.

Note that the paths of files to be tested are canonified using File::Spec->canonpath before any matching is attempted, which can impact how the exclusion rules apply. If your exclusion rules do not seem to be working, turn on the debug option to see the paths of the files that are being kept/excluded.

path Set path to the path to the top-level directory which contains the files to be tested. Defaults to the current directory (i.e. ".").
perltidyrc By default, <B>perltidyB> will attempt to read its options from the .perltidyrc file on your system. Set perltidyrc to the path to a custom file if you would like to control the <B>perltidyB> options used during testing.
mute By default, run_tests() will output diagnostics about any errors reported by <B>perltidyB>, as well as any actual differences found between the pre-tidied and post-tidied files. Set mute to a true value to turn off that diagnostic output.
skip_all Set skip_all to a true value to skip all tests. Default is false.

list_files ( [ start_path | CI%args ] )

Generate the list of files to be tested. Generally not called directly.

load_file ( path_to_file )

Load the file to be tested from disk and return the contents. Generally not called directly.

is_file_tidy ( path_to_file [ , path_to_perltidyrc ] )

Test if a file is tidy or not. Generally not called directly.




Edmund von der Burg, <evdb at>


Duncan J. Ferguson, <duncan_j_ferguson at>

Stephen, <stephen at>

Larry Leszczynski, <larryl at>


Please let me know if you have any comments or suggestions.



Copyright 2007 Edmund von der Burg, all rights reserved.


This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 TEST::PERLTIDY (3) 2013-01-04

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.