|
ExportAbove - set sub or var names into @EXPORT* automatically |
ExportAbove - set sub or var names into @EXPORT* automatically
package SomeModule; use Exporter; @ISA = qw(Exporter);
$qux = ...; # NOT export
sub foo {...} # NOT export
no ExportAbove;
@quux = (...); # into @EXPORT
sub bar {...} # into @EXPORT
use ExportAbove;
%quuux = (...); # into %EXPORT_TAGS and @EXPORT_OK
sub baz {...} # into %EXPORT_TAGS and @EXPORT_OK
use ExportAbove qw(:Tag OK);
$goo = ...; # NOT export
sub gle {...} # NOT export
# End of SomeModule
ExportAbove is a helper module for Exporter.
ExportAbove sets your module's subroutine or variable (scalar, array or hash) names into @EXPORT, @EXPORT_OK or %EXPORT_TAGS automatically. You do not have to write '@EXPORT = qw(...);' and so on. Instead write 'use ExportAbove;' below the subroutine or variable definitions you want to export.
You do not have to write same subroutine or variable names twice at '@EXPORT = qw(...);' and its definition. It makes module maintenance easy. If you want to change an exported names, you simply change only its definitions. If you want to move an exported subroutine or variable to another related module, simply do it.
If you want to export some subroutines or variables in default, write as following below its definitions.
use ExportAbove;
If you want to export some subroutines or variables on demand, write as following below its definitions.
use ExportAbove 'OK';
If you want to export some subroutines or variables in default or on demand by the tag name 'Tag', write as following below its definitions.
use ExportAbove ':Tag';
Two or more tag names are available as following.
use ExportAbove qw(:Foo :Bar);
If you want to export some subroutines or variables not in default and on demand by the tag name 'Tag', write as following below its definitions.
use ExportAbove qw(:Tag OK);
Two or more tag names are available.
If you do not want to export some subroutines or variables, write as following below its definitions.
no ExportAbove;
Mixed uses are available. See SYNOPSIS above.
ExportAbove never set all capital names such as BEGIN, AUTOLOAD, @ISA,... into @EXPORT*.
ExportAbove does NOT export the names you specified. Exporter module does it. Please do NOT forget to use Exporter and set 'Exporter' into @ISA.
Exporter
|
ExportAbove - set sub or var names into @EXPORT* automatically |