Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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


In reply to tidyview - a tool for a best practice by leriksen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (8)
    As of 2014-09-23 10:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (216 votes), past polls