Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
As far as I know, there is no way to reliably automate this process. My experience with automatic code reformatters and analyzers is - to date - rather disappointing. But maybe I'm wrong.

You could think about building up a generalized library for your area of interest and to build by hand each of the scripts so that it's generally built of a few library calls.

Something I would do on the other side is that it's probably way too messy to test and document all existing code; and even if you don't know for sure, you can reasonably assume most of what existing scripts do is correct. Therefore I'd:

  • Write the new scripts as simply and fast as possible
  • Run them on the very same production cases old scripts are run upon
  • Find an automated way to keep track of script executions, number of times the scripts executed correctly and number of times, inputs and outputs of the times the behavoiur was different
This way you'll:
  • save a lot of time testing
  • spot a lot of errors in both old and new scripts, not only in coding but more interestingly in the functional behaviour
  • create test cases (better: automatic test cases) for existing stuff, so you'll know if something modified here breaks something there
At the point you are now, it's the right time to implement something like this. It won't cost so much now but will be very useful in the future.

In reply to Re: Finding duplicated code in Perl by l3nz
in thread Finding duplicated code in Perl by shushu

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 making s'mores by the fire in the courtyard of the Monastery: (15)
    As of 2014-10-22 16:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (119 votes), past polls