Test::PerlTidy - check that all your files are tidy.
# In a file like 't/perltidy.t' use Test::PerlTidy; run_tests();
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 it's the only major language I can think of (with the possible exception of the recent, yet very Java-like C#) that doesn't have at least one style that's good enough." http://www.artima.com/weblogs/viewpost.jsp?thread=74230
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 the_messy_file.pl'.
Perl::Tidy
evdb@ecclestoad.co.uk Edmund von der Burg
Please let me know if you have any comments or suggestions.
http://ecclestoad.co.uk/
This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.
To install Test::PerlTidy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::PerlTidy
CPAN shell
perl -MCPAN -e shell install Test::PerlTidy
For more information on module installation, please visit the detailed CPAN module installation guide.