=encoding euc-jp =head1 NAME =begin original autouse - postpone load of modules until a function is used =end original autouse - 関数が使われるまでモジュールの読み込みを延期する =head1 SYNOPSIS use autouse 'Carp' => qw(carp croak); carp "this carp was predeclared and autoused "; =head1 DESCRIPTION =begin original If the module C is already loaded, then the declaration =end original モジュール C が既に読み込まれていれば、以下の宣言は use autouse 'Module' => qw(func1 func2($;$)); =begin original is equivalent to =end original 以下と等価です use Module qw(func1 func2); =begin original if C defines func2() with prototype C<($;$)>, and func1() has no prototypes. (At least if C uses C's C, otherwise it is a fatal error.) =end original C で、プロトタイプ C<($;$)> で func2() を、プロトタイプなしで func1() を定義している場合です。 (少なくとも C が C の C を使っている場合です; さもなければ致命的エラーになります。) =begin original If the module C is not loaded yet, then the above declaration declares functions func1() and func2() in the current package. When these functions are called, they load the package C if needed, and substitute themselves with the correct definitions. =end original モジュール C がまだ読み込まれていない場合、上述の宣言は 現在のパッケージの関数 func1() と func2() を宣言します。 これらの関数が呼び出されると、必要ならパッケージが C が読み込まれ、 正しい定義と置き換えられます。 =begin _deprecated use Module qw(Module::func3); will work and is the equivalent to: use Module qw(func3); It is not a very useful feature and has been deprecated. =end _deprecated =head1 WARNING =begin original Using C will move important steps of your program's execution from compile time to runtime. This can =end original Using C will move important steps of your program's execution from compile time to runtime. This can (TBT) =over 4 =item * =begin original Break the execution of your program if the module you Cd has some initialization which it expects to be done early. =end original Break the execution of your program if the module you Cd has some initialization which it expects to be done early. (TBT) =item * =begin original hide bugs in your code since important checks (like correctness of prototypes) is moved from compile time to runtime. In particular, if the prototype you specified on C line is wrong, you will not find it out until the corresponding function is executed. This will be very unfortunate for functions which are not always called (note that for such functions Cing gives biggest win, for a workaround see below). =end original hide bugs in your code since important checks (like correctness of prototypes) is moved from compile time to runtime. In particular, if the prototype you specified on C line is wrong, you will not find it out until the corresponding function is executed. This will be very unfortunate for functions which are not always called (note that for such functions Cing gives biggest win, for a workaround see below). (TBT) =back =begin original To alleviate the second problem (partially) it is advised to write your scripts like this: =end original To alleviate the second problem (partially) it is advised to write your scripts like this: (TBT) use Module; use autouse Module => qw(carp($) croak(&$)); carp "this carp was predeclared and autoused "; =begin original The first line ensures that the errors in your argument specification are found early. When you ship your application you should comment out the first line, since it makes the second one useless. =end original The first line ensures that the errors in your argument specification are found early. When you ship your application you should comment out the first line, since it makes the second one useless. (TBT) =head1 AUTHOR Ilya Zakharevich (ilya@math.ohio-state.edu) =head1 SEE ALSO perl(1). =cut