It's a matter of personal preference, but I have very few subs which are more than about 30 lines in length - that way, they fit on the screen, and the logic is easy to follow. If it is getting too long, I remove a set of lines which together form a single logical unit and put that in a separate sub. The name of the new sub reflects that single piece of logic, and so makes the original code a lot easier to follow.

I have a few modules which are about 1000 lines in length, but these start getting difficult to maintain. Most of my modules are less than 500 lines.

I'm wondering how much repeated code you have in your 3 modules - with a bit of refactoring, you could probably split those modules up, and make more of code reuse. Besides being easier to follow, they'll make maintenance less of a nightmare.

Clint


In reply to Re: Is there an ideal module size or subroutine size? by clinton
in thread Is there an ideal module size or subroutine size? by talexb

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.