Hello Craigbert, and welcome to the Monastery!

I would like to add two pieces of advice. First, ensure that the existing code has a good test harness; then, as your refactoring progresses, run your new, refactored code under this same harness to verify that it works exactly the same as the original. You will also find it invaluable to place your work under version control (e.g. using git); that way, when a test fails you can easily roll back the latest changes until you identify the change that introduced the problem. If your existing Perl code doesn’t already have a test harness, look at Test::Tutorial, and use the Test::More module which comes with Perl.

Second, remember that related code (data and subroutines) should be grouped together into the same module; but separate modules should be loosely coupled to one another (see the Wikipedia article on Loose coupling.) If your modules are loosely coupled, you will be able to work on refactoring one module without having to worry about the impact of your refactoring on the code in other modules (i.e., the rest of the program). Keep these principles in mind as you design the refactoring, and you will find that the work progresses more logically and “naturally”, and that the final product is more easily maintained and extended.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


In reply to Re: How best to break apart a large perl program by Athanasius
in thread How best to break apart a large perl program by Craigbert

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.