I normally tend to write Perl modules only when I think they would be useful across different Perl scripts. But here's a question: When we write Perl modules, do we only write them when a pm would be used across different scripts implementing different tasks? OR Can we write Perl modules to group all the sub-functions within one script and put them in the module, so that what we get in the end is a C-programming style separation of sub routines? E.g., in C, you could call the program with the 'main' function as the 'Client' program and create another program that implements the sub-functions that the client can invoke. In this way, the client program simply invoke the services of the program implementing sub-routines. This also ensures that any change to the internal implementation of the sub-routine would require no change to the client program. Can we do the same in Perl using a perl module? Any thoughts would be much appreciated. Thank you!

In reply to Can we have C-style Modularity? by sumeetgrover

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.