in reply to #include equivalent in Perl.
"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
|
|---|