- @INC
-
The array
@INCcontains the list of places that thedo EXPR,require, oruseconstructs look for their library files. It initially consists of the arguments to any -I command-line switches, followed by the default Perl library, probably /usr/local/lib/perl. Prior to Perl 5.26,.-which represents the current directory, was included in@INC; it has been removed. This change in behavior is documented inPERL_USE_UNSAFE_INCand it is not recommended that.be re-added to@INC. If you need to modify@INCat runtime, you should use theuse libpragma to get the machine-dependent library properly loaded as well:配列
@INCには、do EXPR,require,useによってライブラリファイルを 探すときに評価する場所のリストが納められています。 初期状態では、コマンドラインスイッチ -I の引数とデフォルトの Perl ライブラリディレクトリ (おそらく /usr/local/lib/perl5) を 順につなげたものです。 Perl 5.26 より前では、カレントディレクトリを表す.が@INCに含まれていました; これは削除されました。 この振る舞いの変更はPERL_USE_UNSAFE_INCに文書化されていて、@INCに.を再追加するのは推奨されません。 実行時に@INC変更する必要がある場合は、マシン依存のライブラリも正しく 読み込むためにuse libを使うべきです:use lib '/mypath/libdir/'; use SomeMod;You can also insert hooks into the file inclusion system by putting Perl code directly into
@INC. Those hooks may be subroutine references, array references or blessed objects. See "require" in perlfunc for details.Perl のコードを直接
@INCに入れることで、ファイルインクルード機構に フックを挿入できます。 このフックはサブルーチンリファレンス、配列リファレンス、bless された オブジェクトが可能です。 詳細については "require" in perlfunc を参照してください。