"without the mess of Module..."

What mess? Personally I find the use of required programs abhorable when creating modules is SOOOOOOO easy. While there are many things to consider when building a module for other programmer's consumption, just doing the following will get you a long way toward better more professional code:

Simply add the following lines to the top of your code:

package MyModule::Name; require Exporter; use strict; use warnings; use vars qw( @ISA @EXPORT ); @ISA = qw( Exporter ); @EXPORT = qw( func1 func2 func3 );

You'll want to replace MyModule::Name with your own app namespace and unique module name and then also replace the func1, func2, and func3 lines with the names ( and any additional ) functions your code has.

Then it's a simple:

use lib qw( /path/to/module/source ); use MyModule::Name;

in your application. What's so hard about that?

You'll also need to add a '1;' at the end of your source that has been mentioned here previously.

P.S. This is a simple example that does not take into consideration name space polution and other best practices.

Frank Wiles <frank@revsys.com>
www.revsys.com


In reply to Re: #include equivalent in Perl. by ides
in thread #include equivalent in Perl. by dislimit

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.