http://www.perlmonks.org?node_id=585941

Coming in at #6 of Damian Conway's Ten Essential Development Pracices is "Agree upon a coherent style and automate it with perltidy."

Now perltidy is an excellent tool with a long heritage, and, importantly, is still under active development - there have been several releases this year. However, I always had problems with the many options it has. The nuber of options isn't surprising, anyone who has used a code formatting tool will know there are many ways to layout code - what to do with bracketsand braces, whitespace and tab handling, new line control, etc etc etc.

So I wrote a previewer for the effect of perltidy options, called tidyview. It is available through [CPAN] and the CVS tree is at [sourceforge].

As a side note, I had a lot of trouble deciding how best to release this to CPAN. CPAN has excellent support for modules, and poor support for applications. CPAN's idea of an application is a single in-line script, all in one file. And most people dont write applications (regardless of language) that way - at a minimum, configuration data is separated out and provided in a text file. In the end I didnt have to do anything special, but it wasn't at all obvious from CPAN's doco that I didn't have to do anything special.

One very nice side-effect of this project has been the creation of a new Tk module for displaying colored diff's - [Tk::DiffText]. This was contributed by a user of tidyview, which completely blew me away. I'd mentioned wanting this feature in the TODO file, so those things really do work!! The fact that now anyone can include colorised diff's in their perl Tk apps, as a result of spinning this feature out of tidyview and into its own module, thrills me to bits.

So if you want to automate perl code formatting with perltidy, but aren't sure exactly which options you need, give tidyview a whirl. I'd like to thank Steve Hancock who wrote perltidy, and provide a whole new API to help tidyview do its job, and Michael Carman, who contributed Tk::DiffText.

...reality must take precedence over public relations, for nature cannot be fooled. - R P Feynmann