Hi there,

I absolutely agree with dragonchild. It's a good idea to create your own library, actually CPAN is based exactly on the: code re-use and encapsulation of functionality, so both good things (what's supposed to do) and (possible) bugs are well localized and easily tracked down.

However, create good modules that don't pollute the main package namespace, document them (POD (man perlpod) is good for that, in-place documentation). Use obvious, self-describing names and use them consistently and everywhere they apply, this way your code will be easy to follow for anyone reading it (for once read, every programmer will know what it does in every program you write). Sometime, encapsulating standard modules and pragmas like you do makes things harder to read until you get used. Some people like to be very explicit about imports and anything that may affect the way a program runs, but if you are comfortable with it, just go ahead, document it well and use it everywhere it's sensible...

I, particularly, don't like to export anything, and prefer to fully qualify names so there's no confusion about where this function came from, etc, but as this can easily become too verbose, some standard, well known modules, may be used without fear, although @EXPORT_OK is cleaner for this.

Good luck!

our $Perl6 is Fantastic;


In reply to Re: Is it a good idea to create custom modules? by Excalibor
in thread Is it a good idea to create custom modules? by kingman

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.