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

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-19 06:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found