What's wrong with making perltidy actually robust enought that we know that nothing has changed.

If you mean either because the file hasn't changed since last it was tidied and perltidy doesn't need to do anything, or because there has been an error and it shouldn't overwrite your original file, then maybe this bit of shell script might prove helpful:

#!/bin/bash PERLTIDY=/usr/bin/perltidy PERLTIDYOPTIONS=' -l 123 ' TOUCH=/bin/touch DIFF=/usr/bin/diff CP=/bin/cp CPOPTIONS=' -v ' WC=/usr/bin/wc if [ $# -gt 0 ] then echo Command line: $0 $@ for file in $@ do if [ ! -e $file.tdy ] then TOUCH $file.tdy fi if [ `$DIFF -q $file $file.tdy | $WC -l` -gt 0 ] then $PERLTIDY $PERLTIDYOPTIONS $file if [ -e $file.ERR ] then echo Error detected-not replacing else if [ `$DIFF -q $file $file.tdy | $WC -l` -gt 0 ] then $CP $CPOPTIONS $file.tdy $file else echo Skipping replacement of $file - tidied file matches ori +ginal fi fi else echo Skipping $file - perltidy on file not necessary fi done else echo Usage: $0 filename [filename2] fi

Hope that helps.


In reply to Re^12: No, "We" Don't Have to Do Anything by atcroft
in thread No, "We" Don't Have to Do Anything by chromatic

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!
  • 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, details, 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, summary, 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.