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

jatill has asked for the wisdom of the Perl Monks concerning the following question:

When I run perltidy on my code, is there a chance the code will break? Phrased another way, can I safely run perltidy against my entire code reposiory or not? Thanks.

Replies are listed 'Best First'.
Re: perltidy safety
by Joost (Canon) on Aug 09, 2005 at 16:10 UTC
Re: perltidy safety
by merlyn (Sage) on Aug 09, 2005 at 16:09 UTC
    No static independent parsing of Perl can completely understand /usr/bin/perl's parsing of a given Perl program. See my (now classic) On Parsing Perl for examples and an explanation.

    Therefore, there will be always be a risk of breakage. If you have a good test suite, be sure to use that.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

Re: perltidy safety
by Old_Gray_Bear (Bishop) on Aug 09, 2005 at 16:24 UTC
    I don't think I have ever had perltidy() break my code in the four or five year I have been using it. I have seen it flush out syntactical faux-pas on my part; but I have not had it generate broken code, unless the code was already broken to begin with. That said, I always run what ever test-suite I have available against both the original code and the perltidy'd code and then explain all of the diffs before I rename/commit/production-ize the .tdy file. Just another Old Paranoid Programmer, I suppose.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: perltidy safety
by joealba (Hermit) on Aug 09, 2005 at 16:44 UTC
      In the same spirit (more of an FYI for the OP), 'perldoc perltidy' does say

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.

Re: perltidy safety
by petdance (Parson) on Aug 09, 2005 at 21:53 UTC
    It's your code. Are you going to believe us if we tell you "Go ahead and just do it?" I wouldn't.

    xoxo,
    Andy