Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

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

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (3)
    As of 2020-07-11 14:22 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found