The standard Exporter module handles the module's external interface, Although you could define your own import method for your package, I guess no one does it.

Here just show an example of using the standard Exporter module to define the external interface to you module.

Suppose you have a module file called puffy.pm, place the following code.

Example:

Package puffy.pm
use strict;
user vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION)

use Exporter;
$VERSION = 1.00; # or higher
@ISA = qw(Exporter);

@Exporter = qw(func1 func2 ...) # Symbols to autoexport
@Exporter_OK = qw(func1_ok func2_ok ...) #Symbols to export on request
%EXPORT_TAGS = (
TAG1 => [...]
TAG2 => [...]
...
);

##############
# Your code
sub func1 {
...
}

sub func2 {
...
}

sub func1_ok {
...
}
...

1; # last line

 

In other files where you want to use puffy.pm, choose one of these lines:

use puffy.pm;                  #Import default symbols into my package.
use puffy.pm qw(func1_ok ...); #Import listed symbols into my package
use puffy.pm (); #Do not import any symbols
use puffy.pm qw(:TAG1); #Import whole tag set

For detail about @EXPORT and @EXPORT_OK, see Perl @EXPORT and @EXPORT_OK