Here is a rule I try to follow: If you think you will use a sub in more than two scripts, turn it into a module. Chances are you will probably use it more that you expect.

I don't use perl for web work so my point of view may be a little different but this is what I do.

I create a module CompanyX and make sub modules as I need them for all the interfaces I need at CompanyX:

Example:
CompanyX::Lotus_Notes
CompanyX::Oracle
CompanyX::file_converter

Now I have a module with all of companyX's interfaces. if the company changes its interface or switches db all I have to do is change either the db link in the script or change the module and all the scripts will be updated.

One other thing no-one mentioned. By using modules all of your simular code is in one location and you can call them from anywere, with include files you have to know the path to the include file. This is not a problem if you are storing all of your files in one location, but you become location dependent.

One other thing, if your code becomes usefull module form will make it easier to share. Just my long winded 4cents

In reply to Re: More about module by Anonymous Monk
in thread More about module by kwtow

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.