There are a good few conventions for making modules and, perlmod is a bit too condensed to learn it IMHO, although an excellent reference.

Sadly most of the knowledge I've gleemed on this subject is in the pages of Debugging Perl, The Perl Cookbook and Object Oriented Perl, so I can't readily submit URL's for the salient points, all these books give a well rounded look at modules and their creation and use, from different angles, with little overlap. If I had to point to one book to use, for this and other reasons it'd be the Cook Book. HTH.

Your code might benefit from indentation and you don't need the brackets around the variables being declared.

You might lessen your future efforts further by making the functions more generic, maintainable and robust:

You were asking for Module specific stuff, and I fear I may be repeating things, you already know. A more precise set of goals to enable you to get `moduled' are:

  1. Learn how to set the module in a remote and common directory. @INC, use lib or -i
  2. Decide which functions are private or public. use Exporter and @Exporter
  3. Ensure your code is legible and well commented. Here is a good place to begin.
  4. Look to CPAN to see if what you're doing has already been done.

<Hint to="greater Perl Monks" type="pretty big one">It is funny that there is no tutorial for modules in Tutorials</Hint>

--
Brother Frankus.

In reply to Re: Creating module files from subroutines by frankus
in thread Creating module files from subroutines by Anonymous Monk

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.