@ISA: 

Within each package a special array called @ISA tells Perl where else to look for a method if it can't find the method in that package. This is how Perl implements inheritance. Each element of the @ISA array is just the name of another package that happens to be used as a class. The packages are recursively searched (depth first) for missing methods, in the order that packages are mentioned in @ISA. This means that if you have two different packages (say, Mom and Dad) in a class's @ISA, Perl would first look for missing methods in Mom and all of her ancestor classes before going on to search through Dad and his ancestors. Classes accessible through @ISA are known as base classes of the current class, which is itself called the derived class.

 

@EXPORT = qw(...); 

Here comes  an example:

@EXPORT    = qw(afunc $scalar @array);   # afunc is a function

Symbols to export by default. So this means import all names in @EXPORT array:

use YourModule qw(:default) 

@EXPORT_OK = qw(...); 

Symbols to export on request.

@EXPORT_OK = qw(&bfunc %hash *typeglob); # explicit prefix on &bfunc

 

If you are only exporting function names it is recommended to omit the ampersand(&), as the implementation is faster this way.

As a general rule, if the module is trying to be object oriented then export nothing. If it's just a collection of functions then @EXPORT_OK anything but use @EXPORT with caution. For function and method names use barewords in preference to names prefixed with ampersands for the export lists.

 

%EXPORT_TAGS = (tag => [...]); 

Define names for sets of symbols

Since the symbols listed within %EXPORT_TAGS must also appear in either @EXPORT or EXPORT_OK,

two utility functions are provided that allow you to easily add tagged sets of symbols to @EXPORT or @EXPORT_OK:

%EXPORT_TAGS = (Bactrian => [qw(aa bb cc)], Dromedary => [qw(aa cc dd)]);

Exporter::export_tags('Bactrian'); # add aa, bb and cc to @EXPORT

Exporter::export_ok_tags('Dromedary'); # add aa, cc and dd to @EXPORT_OK

To import the all names in a tag:

use YourModule qw(:tag1)

 

How to Import

In other files which wish to use your module there are three basic ways for them to load your module and import its symbols:

use YourModule;

This imports all the symbols from YourModule's @EXPORT into the namespace of the use statement.

use YourModule ();

This causes perl to load your module but does not import any symbols.

use YourModule qw(...);

This imports only the symbols listed by the caller into their namespace. All listed symbols must be in your @EXPORT or @EXPORT_OK , else an error occurs. The advanced export features of Exporter are accessed like this, but with list entries that are syntactically distinct from symbol names.

Unless you want to use its advanced features, this is probably all you need to know to use Exporter.

 

Specialised Import Lists

If any of the entries in an import list begins with !, : or / then the list is treated as a series of specifications which either add to or delete from the list of names to import. They are processed left to right. Specifications are in the form:

[!]name         This name only

[!]:DEFAULT     All names in @EXPORT

[!]:tag         All names in $EXPORT_TAGS{tag} anonymous list

[!]/pattern/    All names in @EXPORT and @EXPORT_OK which match

A leading ! indicates that matching names should be deleted from the list of names to import. If the first specification is a deletion it is treated as though preceded by :DEFAULT. If you just want to import extra names in addition to the default set you will still need to include :DEFAULT explicitly.