=encoding euc-jp =head1 NAME =begin original lib - manipulate @INC at compile time =end original lib - コンパイル時に @INC を操作する =head1 SYNOPSIS use lib LIST; no lib LIST; =head1 DESCRIPTION =begin original This is a small simple module which simplifies the manipulation of @INC at compile time. =end original これはコンパイル時の @INC の操作を簡単にするための小さい単純な モジュールです。 =begin original It is typically used to add extra directories to perl's search path so that later C or C statements will find modules which are not located on perl's default search path. =end original 典型的には、後で C や C が perl のデフォルトの検索パスにない モジュールを見つけられるように、perl の検索パスにディレクトリを追加するために 使われます。 =head2 Adding directories to @INC =begin original The parameters to C are added to the start of the perl search path. Saying =end original C の引数は perl 検索パスの先頭に追加されます。 以下のようにすると use lib LIST; =begin original is I the same as saying =end original 以下のものと I<ほぼ> 同じです BEGIN { unshift(@INC, LIST) } =begin original For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is added to @INC in front of $dir. lib.pm also checks if directories called $dir/$version and $dir/$version/$archname exist and adds these directories to @INC. =end original LIST のそれぞれのディレクトリ (ここでは $dir と呼びます) に対して、 lib モジュールは $dir/$archname/auto というディレクトリが存在するかどうかも チェックします。 もしそうなら $dir/$archname ディレクトリは対応するアーキテクチャ固有の ディレクトリと仮定して、$dir の前に @INC に追加します。 lib.pm は $dir/$version と $dir/$version/$archname というディレクトリが あるかどうかもチェックして、これらのディレクトリを @INC に追加します。 =begin original The current value of C<$archname> can be found with this command: =end original 現在の C<$archname> の値は以下のコマンドで分かります: perl -V:archname =begin original The corresponding command to get the current value of C<$version> is: =end original 対応する、現在の C<$version> の値を得るためのコマンドは: perl -V:version =begin original To avoid memory leaks, all trailing duplicate entries in @INC are removed. =end original メモリリークを避けるために、@INC の末尾の重複するエントリは削除されます。 =head2 Deleting directories from @INC (@INC からディレクトリを削除する) =begin original You should normally only add directories to @INC. If you need to delete directories from @INC take care to only delete those which you added yourself or which you are certain are not needed by other modules in your script. Other modules may have added directories which they need for correct operation. =end original 通常は @INC に対してディレクトリを追加するだけにするべきです。 @INC からディレクトリを削除する必要がある場合は、自分自身で追加したものか、 自分のスクリプトの他のモジュールにとって不要であることが確実であるものだけを 削除するように注意してください。 その他のモジュールは正しい動作のための追加のディレクトリが あるかもしれません。 =begin original The C statement deletes all instances of each named directory from @INC. =end original C 文は @INC からそれぞれの名前付きディレクトリの実体を削除します。 =begin original For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is also deleted from @INC. =end original LIST のそれぞれのディレクトリ (ここでは $dir と呼びます) に対して、 lib モジュールは $dir/$archname/auto というディレクトリが存在するかどうかも チェックします。 もしそうなら $dir/$archname ディレクトリは対応するアーキテクチャ固有の ディレクトリと仮定して、これも @INC から削除します。 =head2 Restoring original @INC (元の @INC を復元する) =begin original When the lib module is first loaded it records the current value of @INC in an array C<@lib::ORIG_INC>. To restore @INC to that value you can say =end original lib モジュールが最初に読み込まれたときに、現在の @INC の値を配列 C<@lib::ORIG_INC> に記録します。 @INC をその値に復元するには、以下のようにします @INC = @lib::ORIG_INC; =head1 CAVEATS (警告) =begin original In order to keep lib.pm small and simple, it only works with Unix filepaths. This doesn't mean it only works on Unix, but non-Unix users must first translate their file paths to Unix conventions. =end original lib.pm を小さく単純にしておくために、Unix ファイルパスでのみ動作します。 これは Unix でのみ動作すると言うことを意味するわけではありませんが、 非 Unix ユーザーはまずファイルパスを Unix の規約に変換しなければなりません。 # VMS users wanting to put [.stuff.moo] into # their @INC would write use lib 'stuff/moo'; =head1 NOTES (注意) =begin original In the future, this module will likely use File::Spec for determining paths, as it does now for Mac OS (where Unix-style or Mac-style paths work, and Unix-style paths are converted properly to Mac-style paths before being added to @INC). =end original 将来、おそらくこのモジュールはパスの決定に File::Spec を使うようになります; Mac OS は今でもしています (Unix 形式と Mac 形式のパスで動作し、Unix 形式の パスは @INC に追加される前に適切に Mac 形式のパスに変換されます)。 =begin original If you try to add a file to @INC as follows: =end original 以下のようにして @INC にファイルを追加しようとすると: use lib 'this_is_a_file.txt'; =begin original C will warn about this. The sole exceptions are files with the C<.par> extension which are intended to be used as libraries. =end original C は警告します。 唯一の例外は、ライブラリとして使うことを意図している C<.par> 拡張子を持つ ファイルです。 =head1 SEE ALSO =begin original FindBin - optional module which deals with paths relative to the source file. =end original FindBin - ソースファイルからの相対パスを扱うオプションモジュール。 =begin original PAR - optional module which can treat C<.par> files as Perl libraries. =end original PAR - C<.par> ファイルを Perl ライブラリとして扱えるオプションモジュール。 =head1 AUTHOR =begin original Tim Bunce, 2nd June 1995. =end original Tim Bunce, 1995 年 6 月 2 日。 =begin original C is maintained by the perl5-porters. Please direct any questions to the canonical mailing list. Anything that is applicable to the CPAN release can be sent to its maintainer, though. =end original C は perl5-porters によって保守されています。 質問は直接公式メーリングリストに送ってください。 しかし、CPAN リリースに当てはまることはその保守者に送ってください。 =begin original Maintainer: The Perl5-Porters =end original 保守者: The Perl5-Porters =begin original Maintainer of the CPAN release: Steffen Mueller =end original CPAN リリースの保守者: Steffen Mueller =head1 COPYRIGHT AND LICENSE This package has been part of the perl core since perl 5.001. It has been released separately to CPAN so older installations can benefit from bug fixes. This package has the same copyright and license as the perl core. =begin meta Translate: SHIRAKATA Kentaro Status: completed =end meta =cut