=head1 名前 ExportAbove - set sub or var names into @EXPORT* automatically ExportAbove - サブルーチンや変数の名前を自動的に@EXPORT*にセット =head1 概要 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 =head1 説明 ExportAbove is a helper module for Exporter. ExportAboveは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. ExportAboveは、モジュールのサブルーチンや変数(スカラ、配列、ハッシュ)の名前を、@EXPORT、@EXPORT_OK、%EXPORT_TAGSに自動的にセットする。'@EXPORT = qw(...);'などと書く必要はない。その代わりにエクスポートしたいサブルーチンや変数定義の下に'use ExportAbove;'と書けばよい。 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. サブルーチン名や変数名を'@EXPORT = qw(...);'と定義で二度書く必要がなくなるので、メンテナンスが容易になる。エクスポートするものの名前を変えたければ単に定義している箇所の名前を変えればよい。エクスポートされているサブルーチンや変数を別のモジュールに移したければ単純にそうすればよい。 =head2 @EXPORTへのセット If you want to export some subroutines or variables in default, write as following below its definitions. デフォルトでエクスポートしたいサブルーチンや変数は、その定義の下に次のように書けばよい。 use ExportAbove; =head2 @EXPORT_OKへのセット If you want to export some subroutines or variables on demand, write as following below its definitions. 必要に応じてエクスポートしたいサブルーチンや変数は、その定義の下に次のように書けばよい。 use ExportAbove 'OK'; =head2 %EXPORT_TAGSと@EXPORTへのセット 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. デフォルトおよびタグ名'Tag'でエクスポートしたいサブルーチンや変数は、その定義の下に次のように書けばよい。 use ExportAbove ':Tag'; Two or more tag names are available as following. 二つ以上のタグ名の場合は次のように書けばよい。 use ExportAbove qw(:Foo :Bar); =head2 %EXPORT_TAGSと@EXPORT_OKへのセット 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. 必要に応じてまたはタグ名'Tag'でエクスポートしたいサブルーチンや変数は、その定義の下に次のように書けばよい。 use ExportAbove qw(:Tag OK); Two or more tag names are available. 二つ以上のタグ名も指定できる。 =head2 エクスポートしない指定 If you do not want to export some subroutines or variables, write as following below its definitions. エクスポートしないサブルーチンや変数は、その定義の下に次のように書けばよい。 no ExportAbove; =head2 useとnoの併用 Mixed uses are available. See SYNOPSIS above. useとnoの併用もできる。上述の概要を見よ。 =head2 例外となる名前 ExportAbove never set all capital names such as BEGIN, AUTOLOAD, @ISA,... into @EXPORT*. BEGIN、AUTOLOAD、@ISAなどの大文字の名前はExportAboveではセットされない。 =head2 Exporterが必要 ExportAbove does NOT export the names you specified. Exporter module does it. Please do NOT forget to use Exporter and set 'Exporter' into @ISA. ExportAbove自身は名前のエクスポートはおこなわない。Exporterモジュールによっておこなう必要がある。use Exporterと@ISAへの'Exporter'のセットを忘れないように。 =head1 作者 nakajima@netstock.co.jp =head1 参照 Exporter =cut