argra****@users*****
argra****@users*****
2011年 12月 14日 (水) 01:42:56 JST
Index: docs/modules/autouse-1.06/autouse.pod diff -u /dev/null docs/modules/autouse-1.06/autouse.pod:1.1 --- /dev/null Wed Dec 14 01:42:56 2011 +++ docs/modules/autouse-1.06/autouse.pod Wed Dec 14 01:42:56 2011 @@ -0,0 +1,170 @@ + +=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<Module> is already loaded, then the declaration + +=end original + +モジュール C<Module> が既に読み込まれていれば、以下の宣言は + + use autouse 'Module' => qw(func1 func2($;$)); + +=begin original + +is equivalent to + +=end original + +以下と等価です + + use Module qw(func1 func2); + +=begin original + +if C<Module> defines func2() with prototype C<($;$)>, and func1() has +no prototypes. (At least if C<Module> uses C<Exporter>'s C<import>, +otherwise it is a fatal error.) + +=end original + +C<Module> で、プロトタイプ C<($;$)> で func2() を、プロトタイプなしで +func1() を定義している場合です。 +(少なくとも C<Module> が C<Exporter> の C<import> を使っている場合です; +さもなければ致命的エラーになります。) + +=begin original + +If the module C<Module> 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<Module> if needed, +and substitute themselves with the correct definitions. + +=end original + +モジュール C<Module> がまだ読み込まれていない場合、上述の宣言は +現在のパッケージの関数 func1() と func2() を宣言します。 +これらの関数が呼び出されると、必要ならパッケージが C<Module> が読み込まれ、 +正しい定義と置き換えられます。 + +=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<autouse> will move important steps of your program's execution +from compile time to runtime. This can + +=end original + +Using C<autouse> 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 C<autouse>d has +some initialization which it expects to be done early. + +=end original + +Break the execution of your program if the module you C<autouse>d 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<autouse> 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 C<autouse>ing 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<autouse> 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 C<autouse>ing 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*****) + +=head1 SEE ALSO + +perl(1). + +=cut +