perlrun > 5.40.0 との差分

perlrun 5.40.0 と 5.10.1 の差分

11
2=encoding utf8
2=encoding euc-jp
33
44=head1 NAME
55
66=begin original
77
88perlrun - how to execute the Perl interpreter
99
1010=end original
1111
1212perlrun - Perl インタプリタの起動方法
1313
1414=head1 SYNOPSIS
1515
16B<perl> S<[ B<-gsTtuUWX> ]>
16B<perl> S<[ B<-sTtuUWX> ]>
17 S<[ B<-h?v> ] [ B<-V>[:I<configvar>] ]>
17 S<[ B<-hv> ] [ B<-V>[:I<configvar>] ]>
1818 S<[ B<-cw> ] [ B<-d>[B<t>][:I<debugger>] ] [ B<-D>[I<number/list>] ]>
1919 S<[ B<-pna> ] [ B<-F>I<pattern> ] [ B<-l>[I<octal>] ] [ B<-0>[I<octal/hexadecimal>] ]>
2020 S<[ B<-I>I<dir> ] [ B<-m>[B<->]I<module> ] [ B<-M>[B<->]I<'module...'> ] [ B<-f> ]>
2121 S<[ B<-C [I<number/list>] >]>
22 S<[ B<-P> ]>
2223 S<[ B<-S> ]>
2324 S<[ B<-x>[I<dir>] ]>
2425 S<[ B<-i>[I<extension>] ]>
2526 S<[ [B<-e>|B<-E>] I<'command'> ] [ B<--> ] [ I<programfile> ] [ I<argument> ]...>
2627
2728=head1 DESCRIPTION
2829
2930=begin original
3031
3132The normal way to run a Perl program is by making it directly
3233executable, or else by passing the name of the source file as an
3334argument on the command line. (An interactive Perl environment
3435is also possible--see L<perldebug> for details on how to do that.)
3536Upon startup, Perl looks for your program in one of the following
3637places:
3738
3839=end original
3940
4041Perl プログラムを実行する普通の方法は、直接実行できる形にするか、
4142コマンドラインの引数としてソースファイルの名前を渡すことです。
4243(対話的な Perl 環境もあります -- どのようにするかの詳細については
43L<perldebug> を参照してください。)
44L<perldebug> を参照してさい。)
4445実行にあたって、Perl は指定されたプログラムを以下に示す場所で
4546探します:
4647
4748=over 4
4849
4950=item 1.
5051
5152=begin original
5253
53Specified line by line via L<-e|/-e commandline> or L<-E|/-E commandline>
54Specified line by line via B<-e> or B<-E> switches on the command line.
54switches on the command line.
5555
5656=end original
5757
58コマンドライン上で L<-e|/-e commandline> か
58コマンドライン上で B<-e> か B<-E> のスイッチで指定された行。
59L<-E|/-E commandline> のスイッチで指定された行。
6059
6160=item 2.
6261
6362=begin original
6463
6564Contained in the file specified by the first filename on the command line.
66(Note that systems supporting the C<#!> notation invoke interpreters this
65(Note that systems supporting the #! notation invoke interpreters this
67way. See L</Location of Perl>.)
66way. See L<Location of Perl>.)
6867
6968=end original
7069
7170コマンドライン上で最初のファイル名として示されたファイルの中。
72(C<#!> 記法をサポートしているシステムでは、このようにして
71(#! 記法をサポートしているシステムでは、このようにして
7372インタプリタを呼び出します。
74L</Location of Perl> を参照してください。)
73L<Location of Perl> を参照してさい。)
7574
7675=item 3.
7776
7877=begin original
7978
8079Passed in implicitly via standard input. This works only if there are
8180no filename arguments--to pass arguments to a STDIN-read program you
8281must explicitly specify a "-" for the program name.
8382
8483=end original
8584
8685標準入力から暗黙に渡される。
87ファイル名を示す引数が無い場合にのみうまくいきます--STDIN から読み込む
86ファイル名を示す引数が無い場合にのみうまくいきます
88プログラムに引数を渡すには、プログラム名として明示的に "-" を
87STDIN から読み込むプログラムに引数を渡すには、
89指定しなくてはなりません、
88プログラム名として明示的に "-" を指定しなくてはなりません、
9089
9190=back
9291
9392=begin original
9493
9594With methods 2 and 3, Perl starts parsing the input file from the
96beginning, unless you've specified a L</-x> switch, in which case it
95beginning, unless you've specified a B<-x> switch, in which case it
97scans for the first line starting with C<#!> and containing the word
96scans for the first line starting with #! and containing the word
9897"perl", and starts there instead. This is useful for running a program
9998embedded in a larger message. (In this case you would indicate the end
10099of the program using the C<__END__> token.)
101100
102101=end original
103102
1042 番目、3 番目の方法では、L</-x> スイッチを指定した場合を除いて、
1032 番目、3 番目の方法では、B<-x> スイッチを指定した場合を除いて、
105Perl は入力ファイルを最初から解析し始めます; B<-x> スイッチを指定した
104Perl は入力ファイルを最初から解析し始めます
106場合には、まず、最初に C<#!> と "perl" という文字列含む行を探し、
105 B<-x> スイッチ
107そこから解析を始めす。
106指定した場合には、ず、最初に #! と "perl" という文字列を
107含む行を探し、そこから解析を始めます。
108108これは、大きなテキストにプログラムを埋め込んで、実行するようなときに便利です。
109109(この場合、プログラムの終わりは、トークン C<__END__> を使って
110110示すとよいでしょう。)
111111
112112=begin original
113113
114The C<#!> line is always examined for switches as the line is being
114The #! line is always examined for switches as the line is being
115115parsed. Thus, if you're on a machine that allows only one argument
116with the C<#!> line, or worse, doesn't even recognize the C<#!> line, you
116with the #! line, or worse, doesn't even recognize the #! line, you
117still can get consistent switch behaviour regardless of how Perl was
117still can get consistent switch behavior regardless of how Perl was
118invoked, even if L</-x> was used to find the beginning of the program.
118invoked, even if B<-x> was used to find the beginning of the program.
119119
120120=end original
121121
122C<#!> を含む行のスイッチが必ず解析されるようになりました。
122#! を含む行のスイッチが必ず解析されるようになりました。
123つまり、C<#!> の行で引数が一つしか許されない、あるいはもっと悪く、
123つまり、#! の行で引数が一つしか許されない、あるいはもっと悪く、
124C<#!> の行が認識されないといったシステムで運用している場合にも、
124#! の行が認識されないといったシステムで運用している場合にも、B<-x> で
125L</-x> でプログラムの開始位置を見つけた場合を含め、どのように Perl が
125プログラムの開始位置を見つけた場合を含め、どのように Perl が起動されたかに
126起動されたかによらず、一貫したスイッチの動作を期待できるようになっています。
126よらず、一貫したスイッチの動作を期待できるようになっています。
127127
128128=begin original
129129
130130Because historically some operating systems silently chopped off
131kernel interpretation of the C<#!> line after 32 characters, some
131kernel interpretation of the #! line after 32 characters, some
132132switches may be passed in on the command line, and some may not;
133133you could even get a "-" without its letter, if you're not careful.
134134You probably want to make sure that all your switches fall either
135135before or after that 32-character boundary. Most switches don't
136136actually care if they're processed redundantly, but getting a "-"
137137instead of a complete switch could cause Perl to try to execute
138standard input instead of your program. And a partial L<-I|/-Idirectory>
138standard input instead of your program. And a partial B<-I> switch
139switch could also cause odd results.
139could also cause odd results.
140140
141141=end original
142142
143歴史的なオペレーティングシステムの中にはカーネルによる C<#!> 行の解釈が、
143歴史的なオペレーティングシステムの中にはカーネルによる #! 行の解釈が、
144144エラーなしに 32 文字で打ち切られてしまうものがありますので、あるスイッチは
145コマンドラインに渡され、あるスイッチは渡されないといったことが起こります;
145コマンドラインに渡され、あるスイッチは渡されないといったことが起こります
146146注意しないと、文字が続かない "-" だけが渡されるといったことも
147147起こり得ます。
148148すべてのスイッチが、確実に 32 文字境界の前か後ろかのどちらかに
149149なるようにしたいことでしょう。
150150多くのスイッチは、余分に処理されても問題ありませんが、完全なスイッチの
151151代わりに "-" が入っていた場合には、プログラムの代わりに、標準入力を Perl に
152152実行させることになってしまいます。
153L<-I|/-Idirectory> スイッチが中途半端になった場合にも
153B<-I> スイッチが中途半端になった場合にもおかしな結果となり得ます。
154おかしな結果となり得ます。
155154
156155=begin original
157156
158157Some switches do care if they are processed twice, for instance
159combinations of L<-l|/-l[octnum]> and L<-0|/-0[octalE<sol>hexadecimal]>.
158combinations of B<-l> and B<-0>. Either put all the switches after
160Either put all the switches after the 32-character boundary (if
159the 32-character boundary (if applicable), or replace the use of
161applicable), or replace the use of B<-0>I<digits> by
160B<-0>I<digits> by C<BEGIN{ $/ = "\0digits"; }>.
162C<BEGIN{ $/ = "\0digits"; }>.
163161
164162=end original
165163
1662 回実行されることに注意する必要のあるスイッチもあります; 例えば
1642 回実行されることに注意する必要のあるスイッチもあります
167L<-l|/-l[octnum]> と L<-0|/-0[octalE<sol>hexadecimal]> の組み合わせです。
165例えば B<-l> と B<-0> の組み合わせです。
168166(可能なら) 両方のスイッチが 32 文字境界の後ろにいくようにするか、
169167B<-0>I<digits> を C<BEGIN{ $/ = "\0digits"; }> で置き換えてください。
170168
171169=begin original
172170
173Parsing of the C<#!> switches starts wherever "perl" is mentioned in the line.
171Parsing of the #! switches starts wherever "perl" is mentioned in the line.
174172The sequences "-*" and "- " are specifically ignored so that you could,
175173if you were so inclined, say
176174
177175=end original
178176
179C<#!> スイッチの解析は、行内で "perl" が示された位置から始まります。
177#! スイッチの解析は、行内で "perl" が示された位置から始まります。
180178とりわけ "-*" と "- " という文字の並びは無視されますので、以下のように
181179書くと:
182180
183181 #!/bin/sh
184 #! -*- perl -*- -p
182 #! -*-perl-*-
185183 eval 'exec perl -x -wS $0 ${1+"$@"}'
186184 if 0;
187185
188186=begin original
189187
190to let Perl see the L</-p> switch.
188to let Perl see the B<-p> switch.
191189
192190=end original
193191
194Perl に L</-p> スイッチを渡すことができます。
192Perl に B<-p> スイッチを渡すことができます。
195193
196194=begin original
197195
198A similar trick involves the I<env> program, if you have it.
196A similar trick involves the B<env> program, if you have it.
199197
200198=end original
201199
202似たようなトリックは(持っていれば) I<env> プログラムでも使えます。
200似たようなトリックは(持っていれば) B<env> プログラムでも使えます。
203201
204202 #!/usr/bin/env perl
205203
206204=begin original
207205
208206The examples above use a relative path to the perl interpreter,
209207getting whatever version is first in the user's path. If you want
210a specific version of Perl, say, perl5.14.1, you should place
208a specific version of Perl, say, perl5.005_57, you should place
211that directly in the C<#!> line's path.
209that directly in the #! line's path.
212210
213211=end original
214212
215213上の例は Perl インタプリタに相対パスを使って、
216214ユーザーの PATH で最初にあったバージョンを使います。
217もし特定のバージョンの Perl、例えば perl5.14.1 が使いたいなら、
215もし特定のバージョンの Perl、例えば perl5.005_57 が使いたいなら、
218C<#!> 行のパスに直接書くべきです。
216#! 行のパスに直接書くべきです。
219217
220218=begin original
221219
222If the C<#!> line does not contain the word "perl" nor the word "indir",
220If the #! line does not contain the word "perl", the program named after
223the program named after the C<#!> is executed instead of the Perl
221the #! is executed instead of the Perl interpreter. This is slightly
224interpreter. This is slightly bizarre, but it helps people on machines
222bizarre, but it helps people on machines that don't do #!, because they
225that don't do C<#!>, because they can tell a program that their SHELL is
223can tell a program that their SHELL is F</usr/bin/perl>, and Perl will then
226F</usr/bin/perl>, and Perl will then dispatch the program to the correct
224dispatch the program to the correct interpreter for them.
227interpreter for them.
228225
229226=end original
230227
231C<#!> 行に "perl" や "indir" という語が含まれていなければ、C<#!> の後に
228#! 行に "perl" という語が含まれていなければ、#! の後に指定された
232指定されたプログラムが Perl インタプリタの代わりに実行されます。
229プログラムが Perl インタプリタの代わりに実行されます。
233これは少し変わっていますが、C<#!> が行なえないマシンを使っている方には
230これは少し変わっていますが、#! が行なえないマシンを使っている方には
234有効でしょう; プログラムに対して使っている SHELL が F</usr/bin/perl> だと
231有効でしょう
235っておけば、Perl が正しいインタプリタを起動しくれるからです。
232プログラムに対して使っている SHELL が F</usr/bin/perl> だと言っおけば、
233Perl が正しいインタプリタを起動してくれるからです。
236234
237235=begin original
238236
239237After locating your program, Perl compiles the entire program to an
240238internal form. If there are any compilation errors, execution of the
241239program is not attempted. (This is unlike the typical shell script,
242240which might run part-way through before finding a syntax error.)
243241
244242=end original
245243
246244プログラムの場所が特定できたなら、Perl はプログラム全体を内部形式に
247245コンパイルし始めます。
248246コンパイルエラーが見つかった時には、プログラムの実行は行なわれません。
249247(これは、構文エラーがある場合にも、途中まで実行される可能性のある、
250248典型的なシェルのスクリプトと異なる点です。)
251249
252250=begin original
253251
254252If the program is syntactically correct, it is executed. If the program
255253runs off the end without hitting an exit() or die() operator, an implicit
256254C<exit(0)> is provided to indicate successful completion.
257255
258256=end original
259257
260258プログラムが構文的に正しければ、実行されることになります。
261259プログラムが、exit() 演算子にも die() 演算子にも当たらないで最後まで
262260到達すると、正常に完了したことを示すために、暗黙の C<exit(0)> が
263261行なわれます。
264262
265263=head2 #! and quoting on non-Unix systems
266264X<hashbang> X<#!>
267265
268266(非 Unix システムでの #! とクォート)
269267
270268=begin original
271269
272Unix's C<#!> technique can be simulated on other systems:
270Unix's #! technique can be simulated on other systems:
273271
274272=end original
275273
276Unix の C<#!> のテクニックは他のシステムでもシミュレートされています。
274Unix の #! のテクニックは他のシステムでもシミュレートされています。
277275
278276=over 4
279277
280278=item OS/2
281279
282280=begin original
283281
284282Put
285283
286284=end original
287285
288286以下のように
289287
290288 extproc perl -S -your_switches
291289
292290=begin original
293291
294as the first line in C<*.cmd> file (L</-S> due to a bug in cmd.exe's
292as the first line in C<*.cmd> file (B<-S> due to a bug in cmd.exe's
295293`extproc' handling).
296294
297295=end original
298296
299C<*.cmd> ファイルの最初の行に書いてください (L</-S> は cmd.exe の
297C<*.cmd> ファイルの最初の行に書いてください (B<-S> は cmd.exe の
300298`extproc' の扱いのバグを引き起こします)。
301299
302300=item MS-DOS
303301
304302=begin original
305303
306304Create a batch file to run your program, and codify it in
307305C<ALTERNATE_SHEBANG> (see the F<dosish.h> file in the source
308306distribution for more information).
309307
310308=end original
311309
312310プログラムを実行するバッチファイルを作って、C<ALTERNATE_SHEBANG> で
313311コード化してください (さらなる情報についてはソース配布パッケージの
314F<dosish.h> ファイルを参照してください)。
312F<dosish.h> ファイルを参照してさい)。
315313
316314=item Win95/NT
317315
318316=begin original
319317
320318The Win95/NT installation, when using the ActiveState installer for Perl,
321319will modify the Registry to associate the F<.pl> extension with the perl
322320interpreter. If you install Perl by other means (including building from
323321the sources), you may have to modify the Registry yourself. Note that
324322this means you can no longer tell the difference between an executable
325323Perl program and a Perl library file.
326324
327325=end original
328326
329327Win95/NT でのインストールにおいて、ActiveState の Perl 用インストーラを
330328使った場合は、拡張子 F<.pl> を Perl インタプリタに関連付けるよう
331329レジストリを変更します。
332330他の方法で Perl をインストールした場合(ソースから構築した場合を含みます)、
333331レジストリを自分で変更する必要があります。
334332これは実行可能な Perl プログラムと Perl ライブラリファイルとの
335333違いがなくなってしまうことに注意してください。
336334
335=item Macintosh
336
337=begin original
338
339Under "Classic" MacOS, a perl program will have the appropriate Creator and
340Type, so that double-clicking them will invoke the MacPerl application.
341Under Mac OS X, clickable apps can be made from any C<#!> script using Wil
342Sanchez' DropScript utility: http://www.wsanchez.net/software/ .
343
344=end original
345
346"Classic" MacOS では、perl プログラムは適切な Creator と Type を
347持っているので、ダブルクリックすれば Perl アプリケーションを起動できます。
348Mac OS X では、クリック可能なアプリケーションは、どんな C<#!> からでも
349Wil Sanchez' DropScript utility を使うことで作成できます:
350http://www.wsanchez.net/software/ 。
351
337352=item VMS
338353
339354=begin original
340355
341356Put
342357
343358=end original
344359
345360以下のように
346361
347 $ perl -mysw 'f$env("procedure")' 'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8' !
362 $ perl -mysw 'f$env("procedure")' 'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8' !
348 $ exit++ + ++$status != 0 and $exit = $status = undef;
363 $ exit++ + ++$status != 0 and $exit = $status = undef;
349364
350365=begin original
351366
352367at the top of your program, where B<-mysw> are any command line switches you
353368want to pass to Perl. You can now invoke the program directly, by saying
354369C<perl program>, or as a DCL procedure, by saying C<@program> (or implicitly
355370via F<DCL$PATH> by just using the name of the program).
356371
357372=end original
358373
359プログラムの先頭に書いてください; ここで B<-mysw> は Perl に渡したい
374プログラムの先頭に書いてください
360コマンドラインスイッチです。
375ここで B<-mysw> は Perl に渡したいコマンドラインスイッチです。
361376これで C<perl program> として直接プログラムを起動できますし、
362377C<@program> として(あるいは F<DCL$PATH> 経由でプログラム名を使って)
363378DSL 手続きとして起動できます。
364379
365380=begin original
366381
367382This incantation is a bit much to remember, but Perl will display it for
368383you if you say C<perl "-V:startperl">.
369384
370385=end original
371386
372387この決まり文句は覚えるには少々長すぎますが、C<perl "-V:startperl"> とすれば
373388Perl がこれを表示してくれます。
374389
375390=back
376391
377392=begin original
378393
379394Command-interpreters on non-Unix systems have rather different ideas
380395on quoting than Unix shells. You'll need to learn the special
381396characters in your command-interpreter (C<*>, C<\> and C<"> are
382397common) and how to protect whitespace and these characters to run
383one-liners (see L<-e|/-e commandline> below).
398one-liners (see B<-e> below).
384399
385400=end original
386401
387非 Unix システムのコマンドインタプリタはクォートに関して Unix シェルと
402非 Unix システムのコマンドインタプリタはクォートに関して
388異なった考え方をしています。
403Unix シェルと異なった考え方をしています。
389404お使いのコマンドインタプリタの特殊文字について (C<*>, C<\>, C<"> は
390一般的です)、そして一行で起動するために(後述する L<-e|/-e commandline> を
405一般的です)、そして一行で起動するために(後述する B<-e> を参照して下さい)
391参照してください)空白や特殊文字を保護する方法について学ぶ必要があるでしょう。
406空白や特殊文字を保護する方法について学ぶ必要があるでしょう。
392407
393408=begin original
394409
395410On some systems, you may have to change single-quotes to double ones,
396411which you must I<not> do on Unix or Plan 9 systems. You might also
397412have to change a single % to a %%.
398413
399414=end original
400415
401416システムによってはシングルクォートをダブルクォートに変更する必要が
402あるかもしれません; しかし Unix や Plan9 のシステムでは
417あるかもしれません
403I<してはいけません>。
418しかし Unix や Plan9 のシステムでは I<してはいけません>。
404419また、単体の % を %% に変更する必要があるかもしれません。
405420
406421=begin original
407422
408423For example:
409424
410425=end original
411426
412427例えば:
413428
414429 # Unix
415430 perl -e 'print "Hello world\n"'
416431
417432 # MS-DOS, etc.
418433 perl -e "print \"Hello world\n\""
419434
435 # Macintosh
436 print "Hello world\n"
437 (then Run "Myscript" or Shift-Command-R)
438
420439 # VMS
421440 perl -e "print ""Hello world\n"""
422441
423442=begin original
424443
425444The problem is that none of this is reliable: it depends on the
426command and it is entirely possible neither works. If I<4DOS> were
445command and it is entirely possible neither works. If B<4DOS> were
427446the command shell, this would probably work better:
428447
429448=end original
430449
431問題は、これらはどれも信頼性がないことです: これはコマンドに依存し、どれも
450問題は、これらはどれも信頼性がないことです
432動かないかもしれません。
451これはコマンドに依存し、どれも動かないかもしれません。
433I<4DOS> がコマンドシェルなら、おそらくよりよく動きます:
452B<4DOS> がコマンドシェルなら、おそらくよりよく動きます:
434453
435454 perl -e "print <Ctrl-x>"Hello world\n<Ctrl-x>""
436455
437456=begin original
438457
439458B<CMD.EXE> in Windows NT slipped a lot of standard Unix functionality in
440459when nobody was looking, but just try to find documentation for its
441460quoting rules.
442461
443462=end original
444463
445464Windows NT の B<CMD.EXE> は誰も見ていない間に多くの標準 Unix 機能が
446465入り込んでいますが、クォートのルールに関しては
447466ドキュメントを探してみてください。
448467
449468=begin original
450469
470Under the Macintosh, it depends which environment you are using. The MacPerl
471shell, or MPW, is much like Unix shells in its support for several
472quoting variants, except that it makes free use of the Macintosh's non-ASCII
473characters as control characters.
474
475=end original
476
477Macintosh では、使っている環境に依存します。
478MacPerl shell や MPW はクォート関係の対応に関して
479かなり Unix シェルと似ています。
480しかし、Macintosh の非 ASCII 文字をコントロール文字として
481自由に使うことができます。
482
483=begin original
484
451485There is no general solution to all of this. It's just a mess.
452486
453487=end original
454488
455489この辺りのことに関する一般的な解決方法はありません。
456490まったくぐちゃぐちゃです。
457491
458492=head2 Location of Perl
459493X<perl, location of interpreter>
460494
461495(Perl の位置)
462496
463497=begin original
464498
465499It may seem obvious to say, but Perl is useful only when users can
466500easily find it. When possible, it's good for both F</usr/bin/perl>
467501and F</usr/local/bin/perl> to be symlinks to the actual binary. If
468502that can't be done, system administrators are strongly encouraged
469503to put (symlinks to) perl and its accompanying utilities into a
470504directory typically found along a user's PATH, or in some other
471505obvious and convenient place.
472506
473507=end original
474508
475509当たり前のように聞こえるかもしれませんが、
476510Perl はユーザーが簡単に発見できる場合にのみ有用です。
477511可能なら、F</usr/bin/perl> と F</usr/local/bin/perl> の両方に
478512実際のバイナリへのシンボリックリンクを置くというのはよい考えです。
479513もしこれが無理なら、システム管理者は Perl と付随するユーティリティ (への
480514シンボリックリンク) を、典型的にユーザーの PATH で見付かるディレクトリか、
481515その他の明らかで便利な場所に置くべきです。
482516
483517=begin original
484518
485519In this documentation, C<#!/usr/bin/perl> on the first line of the program
486520will stand in for whatever method works on your system. You are
487521advised to use a specific path if you care about a specific version.
488522
489523=end original
490524
491525このドキュメントでは、C<#!/usr/bin/perl> とプログラムの先頭に書けば
492526システムの全てのメソッドが実行できるものとしています。
493527特定のバージョンを使いたい場合は、特定のパスを使うか:
494528
495 #!/usr/local/bin/perl5.14
529 #!/usr/local/bin/perl5.00554
496530
497531=begin original
498532
499533or if you just want to be running at least version, place a statement
500534like this at the top of your program:
501535
502536=end original
503537
504538あるいは単に最低限のバージョンを指定した場合は、
505539以下のような行をプログラムの先頭に置いてください:
506540
507 use v5.14;
541 use 5.005_54;
508542
509543=head2 Command Switches
510544X<perl, command switches> X<command switches>
511545
512546(コマンドスイッチ)
513547
514548=begin original
515549
516550As with all standard commands, a single-character switch may be
517551clustered with the following switch, if any.
518552
519553=end original
520554
521555全ての標準コマンドと同様に、1 文字のスイッチは、次に続くスイッチが
522556あれば、それとつなげることができます。
523557
524558 #!/usr/bin/perl -spi.orig # same as -s -p -i.orig
525559
526560=begin original
527561
528A C<--> signals the end of options and disables further option processing. Any
529arguments after the C<--> are treated as filenames and arguments.
530
531=end original
532
533C<--> はオプションの末尾を示してさらなるオプション処理を無効にします。
534C<--> の後ろの引数は全てファイル名と引数として扱われます。
535
536=begin original
537
538562Switches include:
539563
540564=end original
541565
542566スイッチ一覧:
543567
544568=over 5
545569
546570=item B<-0>[I<octal/hexadecimal>]
547571X<-0> X<$/>
548572
549573=begin original
550574
551575specifies the input record separator (C<$/>) as an octal or
552576hexadecimal number. If there are no digits, the null character is the
553577separator. Other switches may precede or follow the digits. For
554example, if you have a version of I<find> which can print filenames
578example, if you have a version of B<find> which can print filenames
555579terminated by the null character, you can say this:
556580
557581=end original
558582
559583入力レコードセパレータ (C<$/>) を 8 進数または 16 進数で示します。
560584digits を指定しないと、ヌル文字がセパレータになります。
561585他のスイッチを前に置いてもかまいませんし、digits のあとに
562586つなげてもかまいません。
563たとえば、ファイル名をヌル文字で区切って表示できる I<find> があれば:
587たとえば、ファイル名をヌル文字で区切って表示できる find があれば:
564588
565589 find . -name '*.orig' -print0 | perl -n0e unlink
566590
567591=begin original
568592
569593The special value 00 will cause Perl to slurp files in paragraph mode.
594The value 0777 will cause Perl to slurp files whole because there is no
595legal byte with that value.
570596
571597=end original
572598
57359900 という特別な値は、Perl にパラグラフモードで、ファイルを読ませます。
6000777 という値は、該当するバイトがないため、
601Perl にファイル全体を読ませることになります。
574602
575603=begin original
576604
577Any value 0400 or above will cause Perl to slurp files whole, but by convention
605If you want to specify any Unicode character, use the hexadecimal
578the value 0777 is the one normally used for this purpose. The L</-g> flag
606format: C<-0xHHH...>, where the C<H> are valid hexadecimal digits.
579is a simpler alias for it.
607(This means that you cannot use the C<-x> with a directory name that
608consists of hexadecimal digits.)
580609
581610=end original
582611
5830400 以上の任意の値は、Perl ァイル全体読ませることになりますが、
612Unicode 文字を指定したい場合は、16 進数のォーマット C<-0xHHH...>
584規約により、普通はこの目的のために値 0777 を使います
613使ってください。
585L</-g> フラグこれのより簡単別名です
614ここで C<H> は 16 進数として有効文字です
615(これは C<-x> で 16 進数の数値からなるディレクトリ名を指定できない
616ことを意味します)。
586617
587=begin original
588
589You can also specify the separator character using hexadecimal notation:
590B<-0xI<HHH...>>, where the C<I<H>> are valid hexadecimal digits. Unlike
591the octal form, this one may be used to specify any Unicode character, even
592those beyond 0xFF. So if you I<really> want a record separator of 0777,
593specify it as B<-0x1FF>. (This means that you cannot use the L</-x> option
594with a directory name that consists of hexadecimal digits, or else Perl
595will think you have specified a hex number to B<-0>.)
596
597=end original
598
59916 進数の記法 B<-0xI<HHH...>> を使ってセパレータ文字を指定することもできます;
600ここで C<I<H>> は 16 進数として有効な文字です。
6018 進数形式と違って、これは 0xFF を超えたものを含む任意の Unicode 文字を
602指定するために使われるかもしれません。
603それで、I<本当に> 0777 のレコード区切りを使いたいなら、B<-0x1FF> として
604指定してください。
605(これは L</-x> オプションで 16 進数の数値からなるディレクトリ名を指定できない
606ことを意味します; さもなければ Perl は指定された 16 進数を B<-0> と
607扱います。)
608
609618=item B<-a>
610619X<-a> X<autosplit>
611620
612621=begin original
613622
614turns on autosplit mode when used with a L</-n> or L</-p>. An implicit
623turns on autosplit mode when used with a B<-n> or B<-p>. An implicit
615624split command to the @F array is done as the first thing inside the
616implicit while loop produced by the L</-n> or L</-p>.
625implicit while loop produced by the B<-n> or B<-p>.
617626
618627=end original
619628
620L</-n> や L</-p> といっしょに用いると、自動 split モードになります。
629B<-n> や B<-p> といっしょに用いると、自動 split モードになります。
621L</-n> や L</-p> で作られる暗黙のループ内の最初の文として、
630B<-n> や B<-p> で作られる暗黙のループ内の最初の文として、
622631配列 @F への暗黙の split コマンドが実行されます。
623632
624633 perl -ane 'print pop(@F), "\n";'
625634
626635=begin original
627636
628637is equivalent to
629638
630639=end original
631640
632641は以下のものと等価です。
633642
634643 while (<>) {
635644 @F = split(' ');
636645 print pop(@F), "\n";
637646 }
638647
639648=begin original
640649
641An alternate delimiter may be specified using L<-F|/-Fpattern>.
650An alternate delimiter may be specified using B<-F>.
642651
643652=end original
644653
645L<-F|/-Fpattern> を使って区切文字を変更することができます。
654B<-F> を使って区切文字を変更することができます。
646655
647=begin original
648
649B<-a> implicitly sets L</-n>.
650
651=end original
652
653B<-a> は暗黙に L</-n> を設定します。
654
655656=item B<-C [I<number/list>]>
656657X<-C>
657658
658659=begin original
659660
660The B<-C> flag controls some of the Perl Unicode features.
661The C<-C> flag controls some of the Perl Unicode features.
661662
662663=end original
663664
664B<-C>フラグは Perl Unicode 機能のいくつかを制御します。
665C<-C>フラグは Perl Unicode 機能のいくつかを制御します。
665666
666667=begin original
667668
668As of 5.8.1, the B<-C> can be followed either by a number or a list
669As of 5.8.1, the C<-C> can be followed either by a number or a list
669670of option letters. The letters, their numeric values, and effects
670671are as follows; listing the letters is equal to summing the numbers.
671672
672673=end original
673674
6745.8.1 から、B<-C> フラグは数値またはオプション文字のリストを
6755.8.1 から、C<-C> フラグは数値またはオプション文字のリストを
675676つけることが出来ます。
676677指定可能な文字と数値およびその効果は以下の通りです;
677678文字のリストは数値の合計と同じです。
678679
679680=begin original
680681
681682 I 1 STDIN is assumed to be in UTF-8
682683 O 2 STDOUT will be in UTF-8
683684 E 4 STDERR will be in UTF-8
684685 S 7 I + O + E
685686 i 8 UTF-8 is the default PerlIO layer for input streams
686687 o 16 UTF-8 is the default PerlIO layer for output streams
687688 D 24 i + o
688689 A 32 the @ARGV elements are expected to be strings encoded
689690 in UTF-8
690 L 64 normally the "IOEioA" are unconditional, the L makes
691 L 64 normally the "IOEioA" are unconditional,
691 them conditional on the locale environment variables
692 the L makes them conditional on the locale environment
692 (the LC_ALL, LC_CTYPE, and LANG, in the order of
693 variables (the LC_ALL, LC_TYPE, and LANG, in the order
693 decreasing precedence) -- if the variables indicate
694 of decreasing precedence) -- if the variables indicate
694695 UTF-8, then the selected "IOEioA" are in effect
695 a 256 Set ${^UTF8CACHE} to -1, to run the UTF-8 caching
696 a 256 Set ${^UTF8CACHE} to -1, to run the UTF-8 caching code in
696 code in debugging mode.
697 debugging mode.
697698
698699=end original
699700
700701 I 1 STDIN は UTF-8 と仮定する
701702 O 2 STDOUT は UTF-8 と仮定する
702703 E 4 STDERR は UTF-8 と仮定する
703704 S 7 I + O + E
704705 i 8 UTF-8 は入力ストリームのデフォルト PerlIO 層
705706 o 16 UTF-8 は出力ストリームのデフォルト PerlIO 層
706707 D 24 i + o
707708 A 32 @ARGV の要素は UTF-8 でエンコードされた文字列と推測する
708709 L 64 通常は "IOEioA" は無条件ですが、
709 L はロケール環境変数(LC_ALL, LC_CTYPE, LANG, 優先度順)によって
710 L はロケール環境変数(LC_ALL, LC_TYPE, LANG, 優先度順)によって
710711 条件付きとなります -- もし変数が UTF-8 を示していれば、
711712 選択された "IOEioA" が有効になります
712713 a 256 デバッグモードで UTF-8 キャッシュコードを実行するために、
713714 ${^UTF8CACHE} を -1 にセットする。
714715
715716=for documenting_the_underdocumented
716717perl.h gives W/128 as PERL_UNICODE_WIDESYSCALLS "/* for Sarathy */"
717718
718719=for todo
719720perltodo mentions Unicode in %ENV and filenames. I guess that these will be
720721options e and f (or F).
721722
722723=begin original
723724
724For example, B<-COE> and B<-C6> will both turn on UTF-8-ness on both
725For example, C<-COE> and C<-C6> will both turn on UTF-8-ness on both
725726STDOUT and STDERR. Repeating letters is just redundant, not cumulative
726727nor toggling.
727728
728729=end original
729730
730例えば、B<-COE> と B<-C6> はどちらも STDOUT と STDERR を UTF-8 化します。
731例えば、C<-COE> と C<-C6> はどちらも STDOUT と STDERR を UTF-8 化します。
731732同じ文字を繰り返しても冗長なだけで、加算されたりトグルになったりはしません。
732733
733734=begin original
734735
735736The C<io> options mean that any subsequent open() (or similar I/O
736operations) in main program scope will have the C<:utf8> PerlIO layer
737operations) will have the C<:utf8> PerlIO layer implicitly applied
737implicitly applied to them, in other words, UTF-8 is expected from any
738to them, in other words, UTF-8 is expected from any input stream,
738input stream, and UTF-8 is produced to any output stream. This is just
739and UTF-8 is produced to any output stream. This is just the default,
739the default set via L<C<${^OPEN}>|perlvar/${^OPEN}>,
740with explicit layers in open() and with binmode() one can manipulate
740with explicit layers in open() and with binmode() one can
741streams as usual.
741manipulate streams as usual. This has no effect on code run in modules.
742742
743743=end original
744744
745C<io> オプションは main プログラムスコープで引き続く open() (あるいは同様の
745C<io> オプションは引き続く open() (あるいは同様の I/O 操作) において
746I/O 操作) において暗黙的に C<:utf8> PerlIO 層が適用されます; 言い換えると、
746暗黙的に C<:utf8> PerlIO 層が適用されます
747入力ストリームでは UTF-8 が想定され、出力ストリームはUTF-8 で出力されます。
747言い換えると、入力ストリームでは UTF-8 が想定され、出力ストリームは
748これは単に L<C<${^OPEN}>|perlvar/${^OPEN}> 設定されたデフォルトであり、
748UTF-8出力されます。
749通常どおり open() と binmode() で明示的に変更できます。
749これは単にデフォルトであり、通常どおり open() と binmode() で明示的に
750これはモジュールの中実行されるコードには無効です。
750変更きます。
751751
752752=begin original
753753
754B<-C> on its own (not followed by any number or option list), or the
754C<-C> on its own (not followed by any number or option list), or the
755empty string C<""> for the L</PERL_UNICODE> environment variable, has the
755empty string C<""> for the C<PERL_UNICODE> environment variable, has the
756same effect as B<-CSDL>. In other words, the standard I/O handles and
756same effect as C<-CSDL>. In other words, the standard I/O handles and
757the default C<open()> layer are UTF-8-fied I<but> only if the locale
757the default C<open()> layer are UTF-8-fied B<but> only if the locale
758758environment variables indicate a UTF-8 locale. This behaviour follows
759759the I<implicit> (and problematic) UTF-8 behaviour of Perl 5.8.0.
760(See L<perl581delta/UTF-8 no longer default under UTF-8 locales>.)
761760
762761=end original
763762
764B<-C> が単体で(数値やオプションリストなし)起動されるか、
763C<-C> が単体で(数値やオプションリストなし)起動されるか、
765L</PERL_UNICODE> 環境変数が空文字列 C<""> の場合、B<-CSDL> と
764C<PERL_UNICODE> 環境変数が空文字列 C<""> の場合、C<-CSDL> と
766765同じ効果となります。
767766言い換えると、標準 I/O 操作とデフォルトの C<open()> 層はロケール環境変数が
768UTF-8 ロケールを示している場合 I<のみ> UTF-8 化されます。
767UTF-8 ロケールを示している場合 B<のみ> UTF-8 化されます。
769768この振る舞いは Perl 5.8.0 での I<暗黙の> (そして問題のある) UTF-8 に
770769関する振る舞いと同じです。
771(L<perl581delta/UTF-8 no longer default under UTF-8 locales> を
772参照してください。)
773770
774771=begin original
775772
776You can use B<-C0> (or C<"0"> for C<PERL_UNICODE>) to explicitly
773You can use C<-C0> (or C<"0"> for C<PERL_UNICODE>) to explicitly
777774disable all the above Unicode features.
778775
779776=end original
780777
781B<-C0> (あるいは C<PERL_UNICODE> に C<"0">) を指定すると
778C<-C0> (あるいは C<PERL_UNICODE> に C<"0">) を指定すると
782779明示的に上記の全ての Unicode 機能を無効にします。
783780
784781=begin original
785782
786783The read-only magic variable C<${^UNICODE}> reflects the numeric value
787of this setting. This variable is set during Perl startup and is
784of this setting. This is variable is set during Perl startup and is
788785thereafter read-only. If you want runtime effects, use the three-arg
789786open() (see L<perlfunc/open>), the two-arg binmode() (see L<perlfunc/binmode>),
790787and the C<open> pragma (see L<open>).
791788
792789=end original
793790
794791読み込み専用のマジック変数 C<${^UNICODE}> にこの設定の数値表現が
795792反映されます。
796793これは Perl 起動時にセットされる変数で、読み込み専用です。
797794実行中に効果を得たい場合は、3 引数の open() (L<perlfunc/open> 参照),
7987952 引数の binmode() (L<perlfunc/binmode> 参照), C<open> プラグマ
799796(L<open> 参照) を使ってください。
800797
801798=begin original
802799
803(In Perls earlier than 5.8.1 the B<-C> switch was a Win32-only switch
800(In Perls earlier than 5.8.1 the C<-C> switch was a Win32-only switch
804801that enabled the use of Unicode-aware "wide system call" Win32 APIs.
805802This feature was practically unused, however, and the command line
806803switch was therefore "recycled".)
807804
808805=end original
809806
810(5.8.1 以前の Perl では B<-C> スイッチは Win32 専用のスイッチで、
807(5.8.1 以前の Perl では C<-C> スイッチは Win32 専用のスイッチで、
811808Unicode 対応の "ワイド文字システムコール" Win32 API を使うためのものでした。
812809この機能は事実上使われませんでしたが、コマンドラインスイッチは
813810"再利用" されました。)
814811
815812=begin original
816813
817B<Note:> Since perl 5.10.1, if the B<-C> option is used on the C<#!> line,
814B<Note:> Since perl 5.10.1, if the -C option is used on the #! line, it
818it must be specified on the command line as well, since the standard streams
815must be specified on the command line as well, since the standard streams
819816are already set up at this point in the execution of the perl interpreter.
820817You can also use binmode() to set the encoding of an I/O stream.
821818
822819=end original
823820
824B<注意:> perl 5.10.1 から、B<-C> スイッチが C<#!> 行で使われると、
821B<注意:> perl 5.10.1 から、-C スイッチが #! 行で使われると、
825822コマンドラインでも指定しなければなりません; なぜなら標準ストリームは
826823perl インタプリタ実行のこの地点で既に設定されているからです。
827824I/O ストリームのエンコーディングの設定に binmode() も使えます。
828825
829826=item B<-c>
830827X<-c>
831828
832829=begin original
833830
834831causes Perl to check the syntax of the program and then exit without
835executing it. Actually, it I<will> execute any C<BEGIN>, C<UNITCHECK>,
832executing it. Actually, it I<will> execute C<BEGIN>, C<UNITCHECK>,
836or C<CHECK> blocks and any C<use> statements: these are considered as
833C<CHECK>, and C<use> blocks, because these are considered as occurring
837occurring outside the execution of your program. C<INIT> and C<END>
834outside the execution of your program. C<INIT> and C<END> blocks,
838blocks, however, will be skipped.
835however, will be skipped.
839836
840837=end original
841838
842839Perl にスクリプトの構文のチェックを行なわせ、実行せずに
843840終了するようにします。
844実際には、C<BEGIN>, C<UNITCHECK>, C<CHECK> ブロックと C<use>
841実際には、C<BEGIN>, C<UNITCHECK>, C<CHECK>, C<use> ブロック
845I<実行します>: これらはプログラムの実行の外側にあるものと
842I<実行します>
846考えられす。
843これらはプログラムの実行の外側にあるものと考えられるからです。
847844C<INIT> と C<END> ブロックはスキップされます。
848845
849=begin original
850
851If the syntax check is successful perl will exit with a status of zero
852and report C<I<yourprogram> syntax OK>. On failure perl will print
853any detected errors and exit with a non-zero status.
854
855=end original
856
857構文チェックが成功すると、終了コード 0 で終了し、
858C<I<yourprogram> syntax OK> と返します。
859失敗時は、perl は検出したエラーを表示し、非 0 終了コードで終了します。
860
861846=item B<-d>
862847X<-d> X<-dt>
863848
864849=item B<-dt>
865850
866851=begin original
867852
868853runs the program under the Perl debugger. See L<perldebug>.
869854If B<t> is specified, it indicates to the debugger that threads
870855will be used in the code being debugged.
871856
872857=end original
873858
874859Perl デバッガの下でプログラムを実行します。
875860L<perldebug> を参照してください。
876861B<t> が指定されると、デバッグするコードがスレッドを使っていることを
877862デバッガに示します。
878863
879=item B<-d:>I<MOD[=bar,baz]>
864=item B<-d:>I<foo[=bar,baz]>
880865X<-d> X<-dt>
881866
882=item B<-dt:>I<MOD[=bar,baz]>
867=item B<-dt:>I<foo[=bar,baz]>
883868
884869=begin original
885870
886runs the program under the control of a debugging, profiling, or tracing
871runs the program under the control of a debugging, profiling, or
887module installed as C<Devel::I<MOD>>. E.g., B<-d:DProf> executes the
872tracing module installed as Devel::foo. E.g., B<-d:DProf> executes
888program using the C<Devel::DProf> profiler. As with the L<-M|/-M[-]module>
873the program using the Devel::DProf profiler. As with the B<-M>
889flag, options may be passed to the C<Devel::I<MOD>> package where they will
874flag, options may be passed to the Devel::foo package where they
890be received and interpreted by the C<Devel::I<MOD>::import> routine. Again,
875will be received and interpreted by the Devel::foo::import routine.
891like B<-M>, use -B<-d:-I<MOD>> to call C<Devel::I<MOD>::unimport> instead of
876The comma-separated list of options must follow a C<=> character.
892import. The comma-separated list of options must follow a C<=> character.
877If B<t> is specified, it indicates to the debugger that threads
893If B<t> is specified, it indicates to the debugger that threads will be used
878will be used in the code being debugged.
894in the code being debugged. See L<perldebug>.
879See L<perldebug>.
895880
896881=end original
897882
898C<Devel::I<MOD>> としてインストールされる デバッグプロファイリング
883Devel::foo としてインストールされる デバッグプロファイリング
899884トレースモジュールの制御下でプログラムを実行します。
900つまり、B<-d:DProf> は C<Devel::DProf> プロファイラを使って
885つまり、B<-d:DProf> は Devel::DProf プロファイラを使って
901886プログラムを実行します。
902L<-M|/-M[-]module> フラグと共に使うと、オプションは
887B<-M> フラグと共に使うと、オプションは Devel::foo パッケージに渡され、
903C<Devel::I<MOD>> パッケージに渡され、C<Devel::I<MOD>::import> ルーチンで
888Devel::foo::import ルーチンで解釈されます。
904解釈されます。
905再び、B<-M> と同様、インポートではなく C<Devel::I<MOD>::unimport> を
906呼び出すには -B<-d:-I<MOD>> を使ってください。
907889オプションをコンマ区切りのリストにするときは C<=> の文字の後に
908890続けなければなりません。
909891B<t> が指定されると、デバッグするコードがスレッドを使っていることを
910892デバッガに示します。
911L<perldebug> を参照してください。
893L<perldebug> を参照してさい。
912894
913895=item B<-D>I<letters>
914896X<-D> X<DEBUGGING> X<-DDEBUGGING>
915897
916898=item B<-D>I<number>
917899
918900=begin original
919901
920sets debugging flags. This switch is enabled only if your perl binary has
902sets debugging flags. To watch how it executes your program, use
921been built with debugging enabled: normal production perls won't have
903B<-Dtls>. (This works only if debugging is compiled into your
922been.
904Perl.) Another nice value is B<-Dx>, which lists your compiled
905syntax tree. And B<-Dr> displays compiled regular expressions;
906the format of the output is explained in L<perldebguts>.
923907
924908=end original
925909
926910デバッグフラグを設定します。
927このオションは、perl バイナリがデバッグ有効にしビルドれて
911スクリトがどのように実行されるかを見るには、B<-Dtls>使っください
928場合にのみ有効になります: 通常の製品版 perl 有効になません。
912(これ、デバッグ機能を盛でコンパイルしたときにだけ働きます)
929
930=begin original
931
932For example, to watch how perl executes your program, use B<-Dtls>.
933Another nice value is B<-Dx>, which lists your compiled syntax tree, and
934B<-Dr> displays compiled regular expressions; the format of the output is
935explained in L<perldebguts>.
936
937=end original
938
939例えば、スクリプトがどのように実行されるかを見るには、B<-Dtls> を
940使ってください。
941913この他に役に立つ値としては、コンパイルされた構文ツリーを表示する、
942B<-Dx> があげられます;
914B<-Dx> があげられます
943B<-Dr> は、コンパイルした正規表現を表示します; 出力形式については
915B<-Dr> は、コンパイルした正規表現を表示します
944L<perldebguts> に説明があります。
916出力形式については L<perldebguts> に説明があります。
945917
946918=begin original
947919
948920As an alternative, specify a number instead of list of letters (e.g.,
949921B<-D14> is equivalent to B<-Dtls>):
950922
951923=end original
952924
953925文字のリストの代わりに数字を指定することもできます
954926(たとえば、B<-D14> は B<-Dtls> と等価です):
955927
956928=begin original
957929
958 1 p Tokenizing and parsing (with v, displays parse
930 1 p Tokenizing and parsing (with v, displays parse stack)
959 stack)
931 2 s Stack snapshots (with v, displays all stacks)
960 2 s Stack snapshots (with v, displays all stacks)
932 4 l Context (loop) stack processing
961 4 l Context (loop) stack processing
933 8 t Trace execution
962 8 t Trace execution
934 16 o Method and overloading resolution
963 16 o Method and overloading resolution
935 32 c String/numeric conversions
964 32 c String/numeric conversions
936 64 P Print profiling info, preprocessor command for -P, source file input state
965 64 P Print profiling info, source file input state
937 128 m Memory and SV allocation
966 128 m Memory and SV allocation
938 256 f Format processing
967 256 f Format processing
939 512 r Regular expression parsing and execution
968 512 r Regular expression parsing and execution
940 1024 x Syntax tree dump
969 1024 x Syntax tree dump
941 2048 u Tainting checks
970 2048 u Tainting checks
942 4096 U Unofficial, User hacking (reserved for private, unreleased use)
971 4096 U Unofficial, User hacking (reserved for private,
943 8192 H Hash dump -- usurps values()
972 unreleased use)
944 16384 X Scratchpad allocation
973 8192 h Show hash randomization debug output (changes to
945 32768 D Cleaning up
974 PL_hash_rand_bits and their origin)
946 65536 S Thread synchronization
975 16384 X Scratchpad allocation
947 131072 T Tokenising
976 32768 D Cleaning up
948 262144 R Include reference counts of dumped variables (eg when using -Ds)
977 65536 S Op slab allocation
949 524288 J Do not s,t,P-debug (Jump over) opcodes within package DB
978 131072 T Tokenizing
950 1048576 v Verbose: use in conjunction with other flags
979 262144 R Include reference counts of dumped variables
951 2097152 C Copy On Write
980 (eg when using -Ds)
952 4194304 A Consistency checks on internal structures
981 524288 J show s,t,P-debug (don't Jump over) on opcodes within
953 8388608 q quiet - currently only suppresses the "EXECUTING" message
982 package DB
983 1048576 v Verbose: use in conjunction with other flags to
984 increase the verbosity of the output. Is a no-op on
985 many of the other flags
986 2097152 C Copy On Write
987 4194304 A Consistency checks on internal structures
988 8388608 q quiet - currently only suppresses the "EXECUTING"
989 message
990 16777216 M trace smart match resolution
991 33554432 B dump suBroutine definitions, including special
992 Blocks like BEGIN
993 67108864 L trace Locale-related info; what gets output is very
994 subject to change
995 134217728 i trace PerlIO layer processing. Set PERLIO_DEBUG to
996 the filename to trace to.
997 268435456 y trace y///, tr/// compilation and execution
998954
999955=end original
1000956
1001 1 p トークン化と構文解析 (v と併用されると、パーススタックの表示)
957 1 p トークン化と構文解析 (v と併用されると、パーススタックの表示)
1002 2 s スタックの表示 (v と併用されると、全てのスタックの表示)
958 2 s スタックの表示 (v と併用されると、全てのスタックの表示)
1003 4 l コンテキスト(ループ)スタックの処理
959 4 l コンテキスト(ループ)スタックの処理
1004 8 t 実行のトレース
960 8 t 実行のトレース
1005 16 o メソッドとオーバーロードの解決
961 16 o メソッドとオーバーロードの解決
1006 32 c 文字列/数値変換
962 32 c 文字列/数値変換
1007 64 P プロファイリング情報、ソースファイル入力状態の表示
963 64 P プロファイリング情報、-P のためのプリプロセッサコマンド、ソースファイル入力状態の表示
1008 128 m メモリと SV の配置
964 128 m メモリと SV の配置
1009 256 f フォーマットの処理
965 256 f フォーマットの処理
1010 512 r 正規表現の解析と実効
966 512 r 正規表現の解析と実効
1011 1024 x 構文トリーのダンプ
967 1024 x 構文トリーのダンプ
1012 2048 u 汚染チェック
968 2048 u 汚染チェック
1013 4096 U 非公式な、ユーザーハック (プライベートな、リリースされない
969 4096 U 非公式な、ユーザーハック (プライベートな、リリースされない利用法のために予約)
1014 利用法ために予約)
970 8192 H ハッシュのダンプ -- values()横取り
1015 8192 h ハッシュンダム化のデバグ出力を表示 (PL_hash_rand_bits と
971 16384 X スクラッチパッドの配置
1016 その元の変更)
972 32768 D 全消去
1017 16384 Xクラチパッの配置
973 65536 Sッド同期
1018 32768 D 全消去
974 131072 T トークン化
1019 65536 S op ラブアロケーショ
975 262144 R ダンプされた変数のリファレンカウトを含む(-Dsのとき)
1020 131072 T クン化
976 524288 J DB パッケジの中では s,t,P デバッグコードを実行しない
1021 262144 R ダンプされた変数ァレンスカウントを含む(-Dsのき)
977 1048576 v 詳細: 他のフラグ組み合わせて使う
1022 524288 J DB パッケージの中での s,t,P デバッグコードを表示(飛び越えない)
978 2097152 Cオンライト
1023 1048576 v 詳細: 他フラグと組み合わせて出力の詳細度を上げる。
979 4194304 A 内部構造一貫性チェック
1024 その他の多くのフラグでは何もしない
980 8388608 q 静粛 - 現在のところ "EXECUTING" メッセージだけを抑制する
1025 2097152 C コピーオンライト
1026 4194304 A 内部構造の一貫性チェック
1027 8388608 q 静粛 - 現在のところ "EXECUTING" メッセージだけを抑制する
1028 16777216 M スマートマッチングの解決をトレース
1029 33554432 B BEGIN のような特殊ブロックを含む、suBroutine 定義のダンプ
1030 67108864 L ロケール関連の情報をトレース; 出力内容は変更される可能性が高い
1031 134217728 i PerlIO 層処理のトレース。PERLIO_DEBUG に
1032 トレースするファイル名を設定すること。
1033 268435456 y y///, tr/// のコンパイルと実行をトレース
1034981
1035982=begin original
1036983
1037984All these flags require B<-DDEBUGGING> when you compile the Perl
1038executable (but see C<:opd> in L<Devel::Peek> or L<re/'debug' mode>
985executable (but see L<Devel::Peek>, L<re> which may change this).
1039which may change this).
986See the F<INSTALL> file in the Perl source distribution
1040See the L<INSTALL> file in the Perl source distribution
987for how to do this. This flag is automatically set if you include B<-g>
1041for how to do this.
988option when C<Configure> asks you about optimizer/debugger flags.
1042989
1043990=end original
1044991
1045992これらの全てのフラグは Perl 実行ファイルをコンパイルするときに
1046993B<-DDEBUGGING> が指定されている必要があります
1047(但しこれを変更するかもしれない L<Devel::Peek> の C<:opd>
994(但しこれを変更するときは L<Devel::Peek>, L<re> を参照してください)。
1048L<re/'debug' mode> を参照してください)。
1049995そうするためにどうすればいいかについては Perl のソース配布パッケージの
1050L<INSTALL> ファイルを参照してください。
996F<INSTALL> ファイルを参照してさい。
997このフラグは C<Configure> が最適化/デバッガフラグを尋ねたときに
998B<-g> オプション込みで指定すれば自動的にセットされます。
1051999
10521000=begin original
10531001
10541002If you're just trying to get a print out of each line of Perl code
10551003as it executes, the way that C<sh -x> provides for shell scripts,
10561004you can't use Perl's B<-D> switch. Instead do this
10571005
10581006=end original
10591007
10601008シェルスクリプトにおける C<sh -x> のように、単に今実行している Perl の
10611009コードを表示したい場合は、Perl の B<-D> スイッチは使えません。
10621010代わりに以下のようにしてください:
10631011
10641012 # If you have "env" utility
10651013 env PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program
10661014
10671015 # Bourne shell syntax
10681016 $ PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program
10691017
10701018 # csh syntax
10711019 % (setenv PERLDB_OPTS "NonStop=1 AutoTrace=1 frame=2"; perl -dS program)
10721020
10731021=begin original
10741022
10751023See L<perldebug> for details and variations.
10761024
10771025=end original
10781026
1079詳細とバリエーションについては L<perldebug> を参照してください。
1027詳細とバリエーションについては L<perldebug> を参照してさい。
10801028
10811029=item B<-e> I<commandline>
10821030X<-e>
10831031
10841032=begin original
10851033
10861034may be used to enter one line of program. If B<-e> is given, Perl
10871035will not look for a filename in the argument list. Multiple B<-e>
10881036commands may be given to build up a multi-line script. Make sure
10891037to use semicolons where you would in a normal program.
10901038
10911039=end original
10921040
109310411 行のプログラムを指定するのに使用します。
10941042B<-e> が指定されると Perl は引数のリストからはファイル名を探しません。
10951043複数の -e コマンドで、複数行のスクリプトを構成することができます。
10961044通常のプログラムでセミコロンを置くところには、セミコロンを使うことに
10971045気を付けてください。
10981046
10991047=item B<-E> I<commandline>
11001048X<-E>
11011049
11021050=begin original
11031051
1104behaves just like L<-e|/-e commandline>, except that it implicitly
1052behaves just like B<-e>, except that it implicitly enables all
1105enables all optional features and builtin functions (in the main
1053optional features (in the main compilation unit). See L<feature>.
1106compilation unit). See L<feature> and L<builtin>.
11071054
11081055=end original
11091056
1110L<-e|/-e commandline> と同様に振る舞いますが、暗黙に全てのオプション機能
1057B<-e> と同様に振る舞いますが、暗黙に全てのオプション機能を(main
1111組み込み関数を(main コンパイル単位で)有効にします。
1058コンパイル単位で)有効にします。
1112L<feature> と L<builtin> を参照してください。
1059L<feature> を参照してください。
11131060
11141061=item B<-f>
1115X<-f> X<sitecustomize> X<sitecustomize.pl>
1062X<-f>
11161063
11171064=begin original
11181065
11191066Disable executing F<$Config{sitelib}/sitecustomize.pl> at startup.
11201067
11211068=end original
11221069
11231070起動時の F<$Config{sitelib}/sitecustomize.pl> の実行を無効化します。
11241071
11251072=begin original
11261073
11271074Perl can be built so that it by default will try to execute
11281075F<$Config{sitelib}/sitecustomize.pl> at startup (in a BEGIN block).
1129This is a hook that allows the sysadmin to customize how Perl behaves.
1076This is a hook that allows the sysadmin to customize how perl behaves.
1130It can for instance be used to add entries to the @INC array to make Perl
1077It can for instance be used to add entries to the @INC array to make perl
11311078find modules in non-standard locations.
11321079
11331080=end original
11341081
11351082Perl は実行時に (BEGIN ブロックの中で) デフォルトで
11361083F<$Config{sitelib}/sitecustomize.pl> を実行しようとさせるように
11371084ビルドできます。
1138これはシステム管理者が、Perl がどのように振る舞うかをカスタマイズするための
1085これはシステム管理者が、perl がどのように振る舞うかをカスタマイズするための
11391086フックです。
1140例えば、Perl が非標準の位置にあるモジュールを見つけられるように @INC 配列に
1087例えば、perl が非標準の位置にあるモジュールを見つけられるように @INC 配列に
11411088エントリを追加するために使えます。
11421089
1143=begin original
1144
1145Perl actually inserts the following code:
1146
1147=end original
1148
1149Perl は実際には以下のコードを挿入します:
1150
1151 BEGIN {
1152 do { local $!; -f "$Config{sitelib}/sitecustomize.pl"; }
1153 && do "$Config{sitelib}/sitecustomize.pl";
1154 }
1155
1156=begin original
1157
1158Since it is an actual C<do> (not a C<require>), F<sitecustomize.pl>
1159doesn't need to return a true value. The code is run in package C<main>,
1160in its own lexical scope. However, if the script dies, C<$@> will not
1161be set.
1162
1163=end original
1164
1165実際には (C<require> ではなく) C<do> なので、F<sitecustomize.pl> は
1166真の値を返す必要はありません。
1167このコードは C<main> パッケージで、独自のレキシカルスコープで動作します。
1168しかし、スクリプトが die すると、C<$@> は設定されません。
1169
1170=begin original
1171
1172The value of C<$Config{sitelib}> is also determined in C code and not
1173read from C<Config.pm>, which is not loaded.
1174
1175=end original
1176
1177C<$Config{sitelib}> の値は C コードで決定され、C<Config.pm> は
1178読み込まれないので、ここの値は使われません。
1179
1180=begin original
1181
1182The code is executed I<very> early. For example, any changes made to
1183C<@INC> will show up in the output of `perl -V`. Of course, C<END>
1184blocks will be likewise executed very late.
1185
1186=end original
1187
1188コードは I<とても> 早くに実行されます。
1189例えば、C<@INC> への変更は `perl -V` の出力に表示されます。
1190もちろん、C<END> ブロックは同様にとても遅くに実行されます。
1191
1192=begin original
1193
1194To determine at runtime if this capability has been compiled in your
1195perl, you can check the value of C<$Config{usesitecustomize}>.
1196
1197=end original
1198
1199この機能がコンパイルされているかどうかを実行時に決定するために、
1200C<$Config{usesitecustomize}> の値をチェックできます。
1201
12021090=item B<-F>I<pattern>
12031091X<-F>
12041092
12051093=begin original
12061094
1207specifies the pattern to split on for L</-a>. The pattern may be
1095specifies the pattern to split on if B<-a> is also in effect. The
1208surrounded by C<//>, C<"">, or C<''>, otherwise it will be put in single
1096pattern may be surrounded by C<//>, C<"">, or C<''>, otherwise it will be
1209quotes. You can't use literal whitespace or NUL characters in the pattern.
1097put in single quotes. You can't use literal whitespace in the pattern.
12101098
12111099=end original
12121100
1213L</-a> のための、split を行なう正規表現を指定します。
1101B<-a> も有効なときに、split を行なう正規表現を指定します。
12141102パターンは C<//>, C<"">, C<''> で囲むか、シングルクォートの中に書きます。
1215パターン中にリテラルな空白や NUL 文字は使えません。
1103パターン中にリテラルな空白は使えません。
12161104
1217=begin original
1218
1219B<-F> implicitly sets both L</-a> and L</-n>.
1220
1221=end original
1222
1223B<-F> は暗黙に L</-a> と L</-n> の両方を設定します。
1224
1225=item B<-g>
1226X<-g>
1227
1228=begin original
1229
1230undefines the input record separator (C<L<$E<sol>|perlvar/$E<sol>>>) and thus
1231enables the slurp mode. In other words, it causes Perl to read whole
1232files at once, instead of line by line.
1233
1234=end original
1235
1236入力レコード区切り文字 (C<L<$E<sol>|perlvar/$E<sol>>>) を未定義化して、
1237吸い込みモードを有効にします。
1238言い換えると、Perl は行単位ではなくファイル全体を一度に
1239読み込むようになります。
1240
1241=begin original
1242
1243This flag is a simpler alias for L<-0777|/-0[octalE<sol>hexadecimal]>.
1244
1245=end original
1246
1247このフラグは L<-0777|/-0[octalE<sol>hexadecimal]> のより簡単な別名です。
1248
1249=begin original
1250
1251Mnemonics: gobble, grab, gulp.
1252
1253=end original
1254
1255記憶法: gobble, grab, gulp.
1256
12571105=item B<-h>
12581106X<-h>
12591107
12601108=begin original
12611109
12621110prints a summary of the options.
12631111
12641112=end original
12651113
12661114オプションの一覧を表示します。
12671115
1268=item B<-?>
1269X<-?>
1270
1271=begin original
1272
1273synonym for B<-h>: prints a summary of the options.
1274
1275=end original
1276
1277B<-h> の同義語: オプションの一覧を表示します。
1278
12791116=item B<-i>[I<extension>]
12801117X<-i> X<in-place>
12811118
12821119=begin original
12831120
12841121specifies that files processed by the C<E<lt>E<gt>> construct are to be
12851122edited in-place. It does this by renaming the input file, opening the
12861123output file by the original name, and selecting that output file as the
12871124default for print() statements. The extension, if supplied, is used to
12881125modify the name of the old file to make a backup copy, following these
12891126rules:
12901127
12911128=end original
12921129
12931130C<E<lt>E<gt>> の構文で処理されたファイルを置き換えるための拡張子を
12941131指定します。
12951132これは、入力ファイルをリネームし、元の名前で出力ファイルを open し、
12961133print() 文のデフォルトとしてその出力ファイルを select することで行ないます。
12971134extension が指定されると、昔の内容のバックアップを行なう
12981135ファイル名の拡張子として、元のファイル名に付け加えられます。
12991136
13001137=begin original
13011138
1302If no extension is supplied, and your system supports it, the original
1139If no extension is supplied, no backup is made and the current file is
1303I<file> is kept open without a name while the output is redirected to
1140overwritten.
1304a new file with the original I<filename>. When perl exits, cleanly or not,
1305the original I<file> is unlinked.
13061141
13071142=end original
13081143
1309extension が指定されず、システムが対応しているなら、 I<file> は名前なしで
1144extension が指定されないと、バックアップを作現在ファイルが
1310開いたまになる一方、出力は元の I<filename> の新しいファイルに
1145上書きされす。
1311リダイレクトされます。
1312クリーンかどうかに関わらず、perl が終了した時点で、元の I<file> は
1313アンリンクされます。
13141146
13151147=begin original
13161148
13171149If the extension doesn't contain a C<*>, then it is appended to the
13181150end of the current filename as a suffix. If the extension does
13191151contain one or more C<*> characters, then each C<*> is replaced
13201152with the current filename. In Perl terms, you could think of this
13211153as:
13221154
13231155=end original
13241156
13251157extension に C<*> が含まれていない場合、現在のファイル名の末尾に
13261158接尾子として付け加えられます。
13271159extension に一つ以上の C<*> の文字がある場合、
13281160それぞれの C<*> は現在のファイル名で置き換えられます。
13291161Perl 的に書くと、以下のようになります:
13301162
13311163 ($backup = $extension) =~ s/\*/$file_name/g;
13321164
13331165=begin original
13341166
13351167This allows you to add a prefix to the backup file, instead of (or in
13361168addition to) a suffix:
13371169
13381170=end original
13391171
13401172以下のようにすると、(接尾子の代わりに、あるいは接尾子に加えて)
13411173バックアップファイルに接頭子をつけることができます。
13421174
1343 $ perl -pi'orig_*' -e 's/bar/baz/' fileA # backup to
1175 $ perl -pi'orig_*' -e 's/bar/baz/' fileA # backup to 'orig_fileA'
1344 # 'orig_fileA'
13451176
13461177=begin original
13471178
13481179Or even to place backup copies of the original files into another
13491180directory (provided the directory already exists):
13501181
13511182=end original
13521183
13531184元のファイルのバックアップコピーを(既にある)他のディレクトリに作ることも
13541185できます:
13551186
1356 $ perl -pi'old/*.orig' -e 's/bar/baz/' fileA # backup to
1187 $ perl -pi'old/*.orig' -e 's/bar/baz/' fileA # backup to 'old/fileA.orig'
1357 # 'old/fileA.orig'
13581188
13591189=begin original
13601190
13611191These sets of one-liners are equivalent:
13621192
13631193=end original
13641194
13651195以下の一行スクリプトは全て等価です:
13661196
1367 $ perl -pi -e 's/bar/baz/' fileA # overwrite current file
1197 $ perl -pi -e 's/bar/baz/' fileA # overwrite current file
1368 $ perl -pi'*' -e 's/bar/baz/' fileA # overwrite current file
1198 $ perl -pi'*' -e 's/bar/baz/' fileA # overwrite current file
13691199
1370 $ perl -pi'.orig' -e 's/bar/baz/' fileA # backup to 'fileA.orig'
1200 $ perl -pi'.orig' -e 's/bar/baz/' fileA # backup to 'fileA.orig'
1371 $ perl -pi'*.orig' -e 's/bar/baz/' fileA # backup to 'fileA.orig'
1201 $ perl -pi'*.orig' -e 's/bar/baz/' fileA # backup to 'fileA.orig'
13721202
13731203=begin original
13741204
13751205From the shell, saying
13761206
13771207=end original
13781208
13791209シェルから以下のように起動すると:
13801210
13811211 $ perl -p -i.orig -e "s/foo/bar/; ... "
13821212
13831213=begin original
13841214
13851215is the same as using the program:
13861216
13871217=end original
13881218
13891219プログラムで以下のようにするのと同じで:
13901220
13911221 #!/usr/bin/perl -pi.orig
13921222 s/foo/bar/;
13931223
13941224=begin original
13951225
13961226which is equivalent to
13971227
13981228=end original
13991229
14001230以下とほぼ等価です:
14011231
14021232 #!/usr/bin/perl
14031233 $extension = '.orig';
14041234 LINE: while (<>) {
14051235 if ($ARGV ne $oldargv) {
14061236 if ($extension !~ /\*/) {
14071237 $backup = $ARGV . $extension;
14081238 }
14091239 else {
14101240 ($backup = $extension) =~ s/\*/$ARGV/g;
14111241 }
14121242 rename($ARGV, $backup);
14131243 open(ARGVOUT, ">$ARGV");
14141244 select(ARGVOUT);
14151245 $oldargv = $ARGV;
14161246 }
14171247 s/foo/bar/;
14181248 }
14191249 continue {
14201250 print; # this prints to original filename
14211251 }
14221252 select(STDOUT);
14231253
14241254=begin original
14251255
14261256except that the B<-i> form doesn't need to compare $ARGV to $oldargv to
14271257know when the filename has changed. It does, however, use ARGVOUT for
14281258the selected filehandle. Note that STDOUT is restored as the default
14291259output filehandle after the loop.
14301260
14311261=end original
14321262
14331263違うのは、B<-i> の形式が、いつファイル名が変わったかを知るために、
14341264$ARGV と $oldargv を比較する必要がないことです。
14351265しかしながら、選択するファイルハンドルとして ARGVOUT は使用します。
14361266ループのあとは、STDOUT がデフォルトのファイルハンドルとして再設定されます。
14371267
14381268=begin original
14391269
14401270As shown above, Perl creates the backup file whether or not any output
14411271is actually changed. So this is just a fancy way to copy files:
14421272
14431273=end original
14441274
14451275上述の通り、Perl はバックアップファイルを実際に出力が変更されたかどうかに
14461276関わらず作成します。
14471277従って、以下はファイルをコピーする変わった方法となります:
14481278
14491279 $ perl -p -i'/some/file/path/*' -e 1 file1 file2 file3...
14501280or
14511281 $ perl -p -i'.orig' -e 1 file1 file2 file3...
14521282
14531283=begin original
14541284
14551285You can use C<eof> without parentheses to locate the end of each input
14561286file, in case you want to append to each file, or reset line numbering
14571287(see example in L<perlfunc/eof>).
14581288
14591289=end original
14601290
14611291個々のファイルの終わりに何かを付け加えたいときや、行番号を
14621292リセットしたいような場合に、個々の入力ファイルの終わりを知るために、
1463括弧の無い C<eof> を使うことができます (L<perlfunc/eof> の例を
1293括弧の無い C<eof> を使うことができます
1464参照してください)
1294(L<perlfunc/eof> の例を参照してください。)
14651295
14661296=begin original
14671297
14681298If, for a given file, Perl is unable to create the backup file as
14691299specified in the extension then it will skip that file and continue on
14701300with the next one (if it exists).
14711301
14721302=end original
14731303
14741304与えられたファイルに対して、Perl が指定された拡張子でバックアップファイルを
14751305作れない場合、そのファイルはスキップされて(もしあれば)次のファイルに
14761306移って継続します。
14771307
14781308=begin original
14791309
1480For a discussion of issues surrounding file permissions and B<-i>, see
1310For a discussion of issues surrounding file permissions and B<-i>,
1481L<perlfaq5/Why does Perl let me delete read-only files? Why does -i clobber
1311see L<perlfaq5/Why does Perl let me delete read-only files? Why does -i clobber protected files? Isn't this a bug in Perl?>.
1482protected files? Isn't this a bug in Perl?>.
14831312
14841313=end original
14851314
14861315ファイルのパーミッションと B<-i> に関する議論については、
14871316L<perlfaq5/Why does Perl let me delete read-only files? Why does -i clobber protected files? Isn't this a bug in Perl?> を
1488参照してください。
1317参照してさい。
14891318
14901319=begin original
14911320
14921321You cannot use B<-i> to create directories or to strip extensions from
14931322files.
14941323
14951324=end original
14961325
14971326B<-i> は、ディレクトリを作ったり、ファイルの拡張子を取り除いたりは
14981327できません。
14991328
15001329=begin original
15011330
15021331Perl does not expand C<~> in filenames, which is good, since some
15031332folks use it for their backup files:
15041333
15051334=end original
15061335
1507Perl は C<~> を展開しません; これはバックアップファイルを以下のようにして
1336Perl は C<~> を展開しません
1508作る人々のためにはよいことです。
1337これはバックアップファイルを以下のようにして作る人々のためにはよいことです。
15091338
15101339 $ perl -pi~ -e 's/foo/bar/' file1 file2 file3...
15111340
15121341=begin original
15131342
15141343Note that because B<-i> renames or deletes the original file before
1515creating a new file of the same name, Unix-style soft and hard links will
1344creating a new file of the same name, UNIX-style soft and hard links will
15161345not be preserved.
15171346
15181347=end original
15191348
15201349B<-i> は同じ名前で新しいファイルを作る前に元のファイルをリネームまたは
1521削除するので、Unix 形式のソフトリンクやハードリンクは保存されないことに
1350削除するので、UNIX 形式のソフトリンクやハードリンクは保存されないことに
15221351注意してください。
15231352
15241353=begin original
15251354
15261355Finally, the B<-i> switch does not impede execution when no
15271356files are given on the command line. In this case, no backup is made
15281357(the original file cannot, of course, be determined) and processing
15291358proceeds from STDIN to STDOUT as might be expected.
15301359
15311360=end original
15321361
15331362最後に、B<-i> スイッチは、コマンドラインでファイルが指定されなくても
15341363実行を妨げません。
15351364この場合、バックアップファイルは作成されず(もちろん、元のファイルが
15361365決定できません)、予想通り、STDIN から STDOUT に処理が行われます。
15371366
15381367=item B<-I>I<directory>
15391368X<-I> X<@INC>
15401369
15411370=begin original
15421371
15431372Directories specified by B<-I> are prepended to the search path for
1544modules (C<@INC>).
1373modules (C<@INC>), and also tells the C preprocessor where to search for
1374include files. The C preprocessor is invoked with B<-P>; by default it
1375searches /usr/include and /usr/lib/perl.
15451376
15461377=end original
15471378
15481379B<-I> で指定されたディレクトリはモジュールの検索パス(C<@INC>)に
1549加えられます。
1380加えられ、また C プリプロセッサにインクルードファイルを探す場所を示します。
1381C プリプロセッサは B<-P> で起動されます。
1382デフォルトでは /usr/include と /usr/lib/perl を探します。
15501383
15511384=item B<-l>[I<octnum>]
15521385X<-l> X<$/> X<$\>
15531386
15541387=begin original
15551388
15561389enables automatic line-ending processing. It has two separate
15571390effects. First, it automatically chomps C<$/> (the input record
1558separator) when used with L</-n> or L</-p>. Second, it assigns C<$\>
1391separator) when used with B<-n> or B<-p>. Second, it assigns C<$\>
15591392(the output record separator) to have the value of I<octnum> so
15601393that any print statements will have that separator added back on.
15611394If I<octnum> is omitted, sets C<$\> to the current value of
15621395C<$/>. For instance, to trim lines to 80 columns:
15631396
15641397=end original
15651398
15661399自動の行末処理を行なうようにします。
15671400これには、2 つの独立した機能があります。
15681 つには、L</-n> や L</-p> を使ったときに、自動的に C<$/>(入力レコード
14011 つには、B<-n> や B<-p> を使ったときに、自動的に C<$/>(入力レコード
15691402セパレータ)を chomp します。
157014032 つめに octnum を C<$\>(出力レコードセパレータ) に代入し、print 文で
15711404セパレータを追加できるようにします。
15721405octnum を指定しなかった場合には、その時点の C<$/> の値をC<$\> に
15731406設定します。
15741407たとえば、行を 80 カラムに切り詰めるには以下のようにします:
15751408
15761409 perl -lpe 'substr($_, 80) = ""'
15771410
15781411=begin original
15791412
15801413Note that the assignment C<$\ = $/> is done when the switch is processed,
15811414so the input record separator can be different than the output record
1582separator if the B<-l> switch is followed by a
1415separator if the B<-l> switch is followed by a B<-0> switch:
1583L<-0|/-0[octalE<sol>hexadecimal]> switch:
15841416
15851417=end original
15861418
15871419C<$\ = $/> という代入は、B<-l> スイッチが処理されるときに
15881420実行されるときに行なわれますので、B<-l> スイッチの後に
1589L<-0|/-0[octalE<sol>hexadecimal]> スイッチを置くようにすれば、
1421B<-0> スイッチを置くようにすれば、入力レコードセパレータを
1590入力レコードセパレータを、
15911422出力レコードセパレータと違うようにもできます:
15921423
15931424 gnufind / -print0 | perl -ln0e 'print "found $_" if -p'
15941425
15951426=begin original
15961427
15971428This sets C<$\> to newline and then sets C<$/> to the null character.
15981429
15991430=end original
16001431
16011432これはまず、C<$\> に改行 (C<$/> のデフォルト値) を設定し、
16021433それから C<$/> にヌル文字を設定します。
16031434
16041435=item B<-m>[B<->]I<module>
16051436X<-m> X<-M>
16061437
16071438=item B<-M>[B<->]I<module>
16081439
16091440=item B<-M>[B<->]I<'module ...'>
16101441
16111442=item B<-[mM]>[B<->]I<module=arg[,arg]...>
16121443
16131444=begin original
16141445
16151446B<-m>I<module> executes C<use> I<module> C<();> before executing your
1616program. This loads the module, but does not call its C<import> method,
1447program.
1617so does not import subroutines and does not give effect to a pragma.
16181448
16191449=end original
16201450
16211451B<-m>I<module> はプログラムの実行前に C<use> I<module> C<();> を
16221452実行します。
1623これはモジュールを読み込みますが、その C<import> メソッドは呼び出さないので、
1624サブルーチンをインポートすることはできず、プラグマの効果もありません。
16251453
16261454=begin original
16271455
16281456B<-M>I<module> executes C<use> I<module> C<;> before executing your
1629program. This loads the module and calls its C<import> method, causing
1457program. You can use quotes to add extra code after the module name,
1630the module to have its default effect, typically importing subroutines
1458e.g., C<'-Mmodule qw(foo bar)'>.
1631or giving effect to a pragma.
1632You can use quotes to add extra code after the module name,
1633e.g., C<'-MI<MODULE> qw(foo bar)'>.
16341459
16351460=end original
16361461
16371462B<-M>I<module> はプログラムの実行前に C<use> I<module> C<;> を実行します。
1638これはモジュールを読み込んで、そ C<import> メソッドを呼び出すの
1463モジュール後ろに追加のコードを加えるためにクォートを使うこともきます。
1639モジュールの (典型的にはサブルーチンのインポートやプラグマの降下のような)
1464つまり C<'-Mmodule qw(foo bar)'> などです。
1640デフォルトの効果が引き起こされます。
1641モジュール名の後ろに追加のコードを加えるためにクォートを使うこともできます;
1642つまり C<'-MI<MODULE> qw(foo bar)'> などです。
16431465
16441466=begin original
16451467
1646If the first character after the B<-M> or B<-m> is a dash (B<->)
1468If the first character after the B<-M> or B<-m> is a dash (C<->)
16471469then the 'use' is replaced with 'no'.
1648This makes no difference for B<-m>.
16491470
16501471=end original
16511472
1652B<-M> または B<-m> の後の最初の文字がダッシュ(B<->)の場合、
1473B<-M> または B<-m> の後の最初の文字がダッシュ(C<->)の場合、
16531474'use' の代わりに 'no' が使われます。
1654これは B<-m> で違いはありません。
16551475
16561476=begin original
16571477
1658Since Perl version 5.39.8, the C<-M> switch and the module name can now
1659be passed in separate command-line arguments:
1660
1661=end original
1662
1663Perl バージョン 5.39.8 から、C<-M> オプションとモジュール名を
1664別のコマンドライン引数として渡すことができます:
1665
1666 perl -M MODULE ... # like perl -MMODULE ...
1667 perl -M MODULE=arg1,arg2,... # like perl -MMODULE=arg1,arg2,...
1668
1669=begin original
1670
16711478A little builtin syntactic sugar means you can also say
1672B<-mI<MODULE>=foo,bar> or B<-MI<MODULE>=foo,bar> as a shortcut for
1479B<-mmodule=foo,bar> or B<-Mmodule=foo,bar> as a shortcut for
1673B<'-MI<MODULE> qw(foo bar)'>. This avoids the need to use quotes when
1480C<'-Mmodule qw(foo bar)'>. This avoids the need to use quotes when
1674importing symbols. The actual code generated by B<-MI<MODULE>=foo,bar> is
1481importing symbols. The actual code generated by B<-Mmodule=foo,bar> is
16751482C<use module split(/,/,q{foo,bar})>. Note that the C<=> form
1676removes the distinction between B<-m> and B<-M>; that is,
1483removes the distinction between B<-m> and B<-M>.
1677B<-mI<MODULE>=foo,bar> is the same as B<-MI<MODULE>=foo,bar>.
16781484
16791485=end original
16801486
1681小さい組み込みのシンタックスシュガーとして、 B<'-MI<MODULE> qw(foo bar)'> の
1487小さい組み込みのシンタックスシュガーとして、 C<'-Mmodule qw(foo bar)'> の
1682代わりに B<-mI<MODULE>=foo,bar> または B<-MI<MODULE>=foo,bar> と
1488代わりに B<-mmodule=foo,bar> または B<-Mmodule=foo,bar> と
16831489書くことができます。
16841490これで、インポートするシンボルにクォートを使わなくてもよいようになります。
1685B<-MI<MODULE>=foo,bar> で生成される実際のコードは
1491B<-Mmodule=foo,bar> で生成される実際のコードは
16861492C<use module split(/,/,q{foo,bar})> です。
1687C<=> の形は B<-m> と B<-M> の間の違いを取り除くことに注意してください;
1493C<=> の形は B<-m> と B<-M> の間の違いを取り除くことに注意してください
1688これは、B<-mI<MODULE>=foo,bar> は B<-MI<MODULE>=foo,bar> と
1689同じということです。
16901494
16911495=begin original
16921496
1693A consequence of the C<split> formulation
1497A consequence of this is that B<-MFoo=number> never does a version check
1694is that B<-MI<MODULE>=number> never does a version check,
1498(unless C<Foo::import()> itself is set up to do a version check, which
1695unless C<I<MODULE>::import()> itself is set up to do a version check, which
1499could happen for example if Foo inherits from Exporter.)
1696could happen for example if I<MODULE> inherits from L<Exporter>.
16971500
16981501=end original
16991502
1700C<split> 操作の結果、例えば I<MODULE>L<Exporter> を継承していたりして、
1503の結果、(例えば Foo が Exporter を継承していたりして、
1701C<I<MODULE>::import()> 自身がバージョンチェックを行うように設定されていない限り
1504C<Foo::import()> 自身がバージョンチェックを行うように設定されていない限り)
1702B<-MI<MODULE>=number> は決してバージョンチェックは行いません。
1505B<-MFoo=number> は決してバージョンチェックは行いません。
17031506
17041507=item B<-n>
17051508X<-n>
17061509
17071510=begin original
17081511
17091512causes Perl to assume the following loop around your program, which
1710makes it iterate over filename arguments somewhat like I<sed -n> or
1513makes it iterate over filename arguments somewhat like B<sed -n> or
1711I<awk>:
1514B<awk>:
17121515
17131516=end original
17141517
17151518以下のようなループが、実際のプログラムの回りにあるかのように Perl に
1716指示します; I<sed -n> や I<awk> のようにファイル名引数上で繰り返しを
1519指示します
1520B<sed -n> や B<awk> のようにファイル名引数上で繰り返しを
17171521行なうことになります:
17181522
17191523 LINE:
17201524 while (<>) {
17211525 ... # your program goes here
17221526 }
17231527
17241528=begin original
17251529
1726Note that the lines are not printed by default. See L</-p> to have
1530Note that the lines are not printed by default. See B<-p> to have
17271531lines printed. If a file named by an argument cannot be opened for
17281532some reason, Perl warns you about it and moves on to the next file.
17291533
17301534=end original
17311535
17321536デフォルトでは、各行が印字されることはありません。
1733各行の印字を行なうには L</-p> を参照してください。
1537各行の印字を行なうには B<-p> を参照してください。
17341538引数で指定されたファイルがなんらかの理由でオープンできなかった場合、
17351539Perl は警告を出して次のファイルに移ります。
17361540
17371541=begin original
17381542
17391543Also note that C<< <> >> passes command line arguments to
17401544L<perlfunc/open>, which doesn't necessarily interpret them as file names.
17411545See L<perlop> for possible security implications.
17421546
17431547=end original
17441548
17451549また、C<< <> >> はコマンドライン引数を L<perlfunc/open> に渡し、これは
17461550ファイル名として解釈する必要はないことに注意してください。
17471551可能性のあるセキュリティの影響については L<perlop> を参照してください。
17481552
17491553=begin original
17501554
17511555Here is an efficient way to delete all files that haven't been modified for
17521556at least a week:
17531557
17541558=end original
17551559
17561560以下にあげるのは、少なくとも 1 週間以上更新されていないファイルを効率的に
17571561削除するものです:
17581562
17591563 find . -mtime +7 -print | perl -nle unlink
17601564
17611565=begin original
17621566
1763This is faster than using the B<-exec> switch of I<find> because you don't
1567This is faster than using the B<-exec> switch of B<find> because you don't
1764have to start a process on every filename found (but it's not faster
1568have to start a process on every filename found. It does suffer from
1765than using the B<-delete> switch available in newer versions of I<find>.
1569the bug of mishandling newlines in pathnames, which you can fix if
1766It does suffer from the bug of mishandling newlines in pathnames, which
1570you follow the example under B<-0>.
1767you can fix if you follow the example under
1768L<-0|/-0[octalE<sol>hexadecimal]>.
17691571
17701572=end original
17711573
17721574これは、ファイル名が見つかるごとにプロセスを起動しなくて済みますので、
1773I<find> の B<-exec> スイッチを使うよりも速くなります
1575B<find> の B<-exec> スイッチを使うよりも速くなります
1774(しかし、より新しい I<find> で利用可能な B<-delete> オプションを使うより
1775速くはないです)。
17761576これはパス名に改行コードがあるとうまく扱えないバグの影響を受けますので、
1777L<-0|/-0[octalE<sol>hexadecimal]> の例に従うことで修正できます。
1577B<-O> の例に従うことで修正できます。
17781578
17791579=begin original
17801580
17811581C<BEGIN> and C<END> blocks may be used to capture control before or after
1782the implicit program loop, just as in I<awk>.
1582the implicit program loop, just as in B<awk>.
17831583
17841584=end original
17851585
1786I<awk> と同じように、暗黙に実行されるプログラムループの前後に実行される
1586B<awk> と同じように、暗黙に実行されるプログラムループの前後に実行される
17871587コードを指定するために、C<BEGIN> ブロックと C<END> ブロックを
17881588使うことができます。
17891589
17901590=item B<-p>
17911591X<-p>
17921592
17931593=begin original
17941594
17951595causes Perl to assume the following loop around your program, which
1796makes it iterate over filename arguments somewhat like I<sed>:
1596makes it iterate over filename arguments somewhat like B<sed>:
17971597
17981598=end original
17991599
1800以下のようなループが、実際のプログラムの回りにあるかのように Perl に
1600以下のようなループが、実際のプログラムの回りにあるかのように
1801指示します; I<sed> のようにファイル名引数上で繰り返しを行なうことに
1601Perl に指示します
1802なります:
1602B<sed> のようにファイル名引数上で繰り返しを行なうことになります:
18031603
18041604 LINE:
18051605 while (<>) {
18061606 ... # your program goes here
18071607 } continue {
18081608 print or die "-p destination: $!\n";
18091609 }
18101610
18111611=begin original
18121612
18131613If a file named by an argument cannot be opened for some reason, Perl
18141614warns you about it, and moves on to the next file. Note that the
18151615lines are printed automatically. An error occurring during printing is
1816treated as fatal. To suppress printing use the L</-n> switch. A B<-p>
1616treated as fatal. To suppress printing use the B<-n> switch. A B<-p>
18171617overrides a B<-n> switch.
18181618
18191619=end original
18201620
18211621引数で指定されたファイルが何らかの理由でオープンできない場合、
18221622Perl は警告を出し、次のファイルに移ります。
18231623各行は、自動的に印字されることになります。
18241624印字中のエラーは致命的とみなされます。
1825印字を抑制するには、L</-n> スイッチを使ってください。
1625印字を抑制するには、B<-n> スイッチを使ってください。
18261626B<-p> は B<-n> スイッチを無効にします。
18271627
18281628=begin original
18291629
18301630C<BEGIN> and C<END> blocks may be used to capture control before or after
1831the implicit loop, just as in I<awk>.
1631the implicit loop, just as in B<awk>.
18321632
18331633=end original
18341634
1835I<awk> と同じように、暗黙に実行されるループの前後に実行されるコードを
1635B<awk> と同じように、暗黙に実行されるループの前後に実行されるコードを
18361636指定するために、C<BEGIN> ブロックと C<END> ブロックを使うことができます。
18371637
1638=item B<-P>
1639X<-P>
1640
1641=begin original
1642
1643B<NOTE: Use of -P is strongly discouraged because of its inherent
1644problems, including poor portability. It is deprecated and will be
1645removed in a future version of Perl.>
1646
1647=end original
1648
1649B<注意: -P の使用は全く薦められません。
1650なぜなら低い移植性を含む、先天的な問題があるからです。
1651これは非推奨であり、将来のバージョンの Perl では取り除かれます。>
1652
1653=begin original
1654
1655This option causes your program to be run through the C preprocessor before
1656compilation by Perl. Because both comments and B<cpp> directives begin
1657with the # character, you should avoid starting comments with any words
1658recognized by the C preprocessor such as C<"if">, C<"else">, or C<"define">.
1659
1660=end original
1661
1662Perl によるコンパイルを行なう前に、スクリプトを C プリプロセッサに
1663かけるようにします。
1664コメントも cpp のディレクティブも # で始まりますから、コメントの最初を
1665C プリプロセッサが認識してしまう C<"if">, C<"else">, C<"define">といった
1666単語で始めるべきではありません。
1667
1668=begin original
1669
1670If you're considering using C<-P>, you might also want to look at the
1671Filter::cpp module from CPAN.
1672
1673=end original
1674
1675C<-P> を使うことを考えているなら、CPAN にある Filter::cpp も
1676参照したほうがよいでしょう。
1677
1678=begin original
1679
1680The problems of -P include, but are not limited to:
1681
1682=end original
1683
1684-P が持つ問題は以下のようなものがあります(これだけではありません):
1685
1686=over 10
1687
1688=item *
1689
1690=begin original
1691
1692The C<#!> line is stripped, so any switches there don't apply.
1693
1694=end original
1695
1696C<#!> 行が取り除かれるので、全てのスイッチは適用されません。
1697
1698=item *
1699
1700=begin original
1701
1702A C<-P> on a C<#!> line doesn't work.
1703
1704=end original
1705
1706C<#!> 行に C<-P> を書いても動作しません。
1707
1708=item *
1709
1710=begin original
1711
1712B<All> lines that begin with (whitespace and) a C<#> but
1713do not look like cpp commands, are stripped, including anything
1714inside Perl strings, regular expressions, and here-docs .
1715
1716=end original
1717
1718(空白と) C<#> で始まり、cpp コマンドでない B<全ての> 行は取り除かれます。
1719Perl 文字列や正規表現やヒヤドキュメントのと途中でも、です。
1720
1721=item *
1722
1723=begin original
1724
1725In some platforms the C preprocessor knows too much: it knows about
1726the C++ -style until-end-of-line comments starting with C<"//">.
1727This will cause problems with common Perl constructs like
1728
1729=end original
1730
1731また、C プロセッサが知りすぎているプラットフォームもあります。
1732C++ スタイルの C<"//"> という「行末までのコメント」を知っている場合です。
1733この場合、以下のような良くある Perl の構造で問題が起こり得ます:
1734
1735 s/foo//;
1736
1737=begin original
1738
1739because after -P this will became illegal code
1740
1741=end original
1742
1743なぜなら -P 適用後以下のような不正なコードになるからです。
1744
1745 s/foo
1746
1747=begin original
1748
1749The workaround is to use some other quoting separator than C<"/">,
1750like for example C<"!">:
1751
1752=end original
1753
1754回避策としては、クオート文字を C<"/"> 以外にする方法があります。
1755以下では C<"!"> にしています:
1756
1757 s!foo!!;
1758
1759=item *
1760
1761=begin original
1762
1763It requires not only a working C preprocessor but also a working
1764F<sed>. If not on UNIX, you are probably out of luck on this.
1765
1766=end original
1767
1768これは C プリプロセッサだけでなく、F<sed> も動作する必要があります。
1769UNIX でない場合、そのような幸運に恵まれないかもしれません。
1770
1771=item *
1772
1773=begin original
1774
1775Script line numbers are not preserved.
1776
1777=end original
1778
1779スクリプトの行番号は保存されません。
1780
1781=item *
1782
1783=begin original
1784
1785The C<-x> does not work with C<-P>.
1786
1787=end original
1788
1789C<-x> は C<-P> と同時には動作しません。
1790
1791=back
1792
18381793=item B<-s>
18391794X<-s>
18401795
18411796=begin original
18421797
18431798enables rudimentary switch parsing for switches on the command
18441799line after the program name but before any filename arguments (or before
18451800an argument of B<-->). Any switch found there is removed from @ARGV and sets the
1846corresponding variable in the Perl program, in the main package. The following program
1801corresponding variable in the Perl program. The following program
18471802prints "1" if the program is invoked with a B<-xyz> switch, and "abc"
18481803if it is invoked with B<-xyz=abc>.
18491804
18501805=end original
18511806
18521807コマンドライン上のプログラム名の後から、ファイル名引数
18531808(または引数 B<-->) の前までのスイッチのための、原始的な解析を
18541809行なえるようにします。
18551810ここで見つかったスイッチは、@ARGV から取り除かれ、対応する Perl プログラムの
1856main パッケージの変数に設定されます。
1811変数に設定されます。
18571812以下のプログラムは、B<-xyz> というスイッチを付けて実行された時にだけ、
18581813"1" と表示し、B<-xyz=abc> と起動された時に "abc" と表示します。
18591814
18601815 #!/usr/bin/perl -s
18611816 if ($xyz) { print "$xyz\n" }
18621817
18631818=begin original
18641819
1865Do note that a switch like B<--help> creates the variable C<${-help}>, which is
1820Do note that a switch like B<--help> creates the variable ${-help}, which is not compliant
1866not compliant with C<use strict "refs">. Also, when using this option on a
1821with C<strict refs>. Also, when using this option on a script with
1867script with warnings enabled you may get a lot of spurious "used only once"
1822warnings enabled you may get a lot of spurious "used only once" warnings.
1868warnings. For these reasons, use of B<-s> is discouraged. See L<Getopt::Long>
1869for much more flexible switch parsing.
18701823
18711824=end original
18721825
1873B<--help> のようなスイッチは変数 C<${-help}> を作成するので、
1826B<--help> のようなスイッチは変数 ${-help} を作成するので、C<strict refs> を
1874C<use strict "refs"> を満たさないことに注意してください。
1827満たさないことに注意してください。
18751828また、警告を有効にしたスクリプトでこのオプションを使うと、大量の
18761829"used only once" という偽警告がでることになります。
1877これらの理由により、B<-s> の仕様は非推奨です。
1878はるかに柔軟なオプションのパース方法については L<Getopt::Long> を
1879参照してください。
18801830
18811831=item B<-S>
18821832X<-S>
18831833
18841834=begin original
18851835
1886makes Perl use the L</PATH> environment variable to search for the
1836makes Perl use the PATH environment variable to search for the
1887program unless the name of the program contains path separators.
1837program (unless the name of the program contains directory separators).
18881838
18891839=end original
18901840
1891プログラム名にパスセパレータ含まないとき
1841Perl がプログラムを探すときに環境変数 PATH を参照するようにします
1892Perl がプログラムを探すときに環境変数 L</PATH> 参照するようにします。
1842(プログラム名がディレクトリセパレータ含むときを除きます)
18931843
18941844=begin original
18951845
18961846On some platforms, this also makes Perl append suffixes to the
18971847filename while searching for it. For example, on Win32 platforms,
18981848the ".bat" and ".cmd" suffixes are appended if a lookup for the
18991849original name fails, and if the name does not already end in one
1900of those suffixes. If your Perl was compiled with C<DEBUGGING> turned
1850of those suffixes. If your Perl was compiled with DEBUGGING turned
1901on, using the L<-Dp|/-Dletters> switch to Perl shows how the search
1851on, using the -Dp switch to Perl shows how the search progresses.
1902progresses.
19031852
19041853=end original
19051854
19061855プラットフォームによっては、Perl はファイルを探すときに拡張子を
19071856追加します。
19081857例えば Win32 プラットフォームでは、元々のファイル名で検索が失敗した場合、
1909".bat" と ".cmd" の拡張子が追加されます; 但し既にそのような拡張子が
1858".bat" と ".cmd" の拡張子が追加されます
1910ついていない場合だけです。
1859但し既にそのような拡張子がついていない場合だけです。
1911Perl が C<DEBUGGING> を有効にしてコンパイルされていた場合、
1860Perl が DEBUGGING を有効にしてコンパイルされていた場合、-Dp スイッチを
1912L<-Dp|/-Dletters> スイッチを
19131861使うことでどのように検索が行われているかを表示させることができます。
19141862
19151863=begin original
19161864
1917Typically this is used to emulate C<#!> startup on platforms that don't
1865Typically this is used to emulate #! startup on platforms that don't
1918support C<#!>. It's also convenient when debugging a script that uses C<#!>,
1866support #!. Its also convenient when debugging a script that uses #!,
19191867and is thus normally found by the shell's $PATH search mechanism.
19201868
19211869=end original
19221870
1923これは、C<#!> をサポートしていないプラットフォームで、C<#!> による実行を
1871これは、#! をサポートしていないプラットフォームで、#! による実行を
19241872エミュレートするために使います。
1925また、C<#!> を使ったスクリプトで、通常はシェルの $PATH 検索メカニズムで
1873また、#! を使ったスクリプトで、通常はシェルの $PATH 検索メカニズムで
19261874見つけられるようなスクリプトをデバッグするのにも便利です。
19271875
19281876=begin original
19291877
19301878This example works on many platforms that have a shell compatible with
19311879Bourne shell:
19321880
19331881=end original
19341882
19351883この例は Bourne shell 互換のシェルを持つ多くのプラットフォームで動きます:
19361884
19371885 #!/usr/bin/perl
19381886 eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
1939 if 0; # ^ Run only under a shell
1887 if $running_under_some_shell;
19401888
19411889=begin original
19421890
19431891The system ignores the first line and feeds the program to F</bin/sh>,
19441892which proceeds to try to execute the Perl program as a shell script.
19451893The shell executes the second line as a normal shell command, and thus
19461894starts up the Perl interpreter. On some systems $0 doesn't always
1947contain the full pathname, so the L</-S> tells Perl to search for the
1895contain the full pathname, so the B<-S> tells Perl to search for the
19481896program if necessary. After Perl locates the program, it parses the
1949lines and ignores them because the check 'if 0' is never true.
1897lines and ignores them because the variable $running_under_some_shell
1950If the program will be interpreted by csh, you will need
1898is never true. If the program will be interpreted by csh, you will need
19511899to replace C<${1+"$@"}> with C<$*>, even though that doesn't understand
1952embedded spaces (and such) in the argument list. To start up I<sh> rather
1900embedded spaces (and such) in the argument list. To start up sh rather
1953than I<csh>, some systems may have to replace the C<#!> line with a line
1901than csh, some systems may have to replace the #! line with a line
19541902containing just a colon, which will be politely ignored by Perl. Other
19551903systems can't control that, and need a totally devious construct that
1956will work under any of I<csh>, I<sh>, or Perl, such as the following:
1904will work under any of B<csh>, B<sh>, or Perl, such as the following:
19571905
19581906=end original
19591907
19601908システムは、最初の行を無視し、プログラムを F</bin/sh> に渡し、
19611909F</bin/sh> は Perl プログラムをシェルプログラムとして実行しようとします。
19621910シェルは 2 行目を通常のシェルコマンドとして実行し、Perl インタプリタを
19631911起動することになります。
19641912$0 にフルパス名が入っているとは限らないシステムもありますので、
1965L</-S> が Perl に必要に応じてプログラムを探すように指示します。
1913B<-S> が Perl に必要に応じてプログラムを探すように指示します。
19661914Perl がプログラムを見つけると、これらの行の解析を始めますが、
1967'if 0' が真になることがないため、無視することになります。
1915$running_under_some_shell が真になることがないため、
1916無視することになります。
19681917プログラムが csh で解釈される場合には、たとえファイル名内に埋め込まれた
19691918スペースなどを扱うことができなくても C<${1+"$@"}> を C<$*> で
19701919置き換える必要があるかもしれません。
1971I<csh> ではなく、I<sh> を起動するように、いくつかのシステムでは、C<#!> の行を
1920csh ではなく、sh を起動するように、いくつかのシステムでは、#! の行を
19721921Perl も無視することになっている、コロンだけの行で置き換える必要が
19731922あるかもしれません。
1974そういった制御が効かないシステムでは、I<csh> でも I<sh> でも
1923そういった制御が効かないシステムでは、B<csh> でも B<sh> でも
19751924Perl でも使える、回りくどい方法を使うことが必要です:
19761925
19771926 eval '(exit $?0)' && eval 'exec perl -wS $0 ${1+"$@"}'
19781927 & eval 'exec /usr/bin/perl -wS $0 $argv:q'
1979 if 0; # ^ Run only under a shell
1928 if $running_under_some_shell;
19801929
19811930=begin original
19821931
1983If the filename supplied contains directory separators (and so is an
1932If the filename supplied contains directory separators (i.e., is an
19841933absolute or relative pathname), and if that file is not found,
19851934platforms that append file extensions will do so and try to look
19861935for the file with those extensions added, one by one.
19871936
19881937=end original
19891938
19901939ファイル名にディレクトリセパレータが含まれていた場合
1991(そしてそれが絶対パスまたは相対パスだった場合)、そしてそのファイルが
1940(つまり絶対パスまたは相対パスだった場合)、そしてそのファイルが
19921941なかった場合、ファイル拡張子を追加するプラットフォームでは
19931942ひとつずつ拡張子を追加して、ファイルを探します。
19941943
19951944=begin original
19961945
19971946On DOS-like platforms, if the program does not contain directory
19981947separators, it will first be searched for in the current directory
19991948before being searched for on the PATH. On Unix platforms, the
20001949program will be searched for strictly on the PATH.
20011950
20021951=end original
20031952
20041953DOS 風のプラットフォームでは、プログラムにディレクトリセパレータが
20051954含まれていなかった場合、PATH を探す前に最初にカレントディレクトリを
20061955探します。
20071956Unix プラットフォームでは、プログラムは厳密に PATH からのみ探されます。
20081957
20091958=item B<-t>
20101959X<-t>
20111960
20121961=begin original
20131962
2014Like L</-T>, but taint checks will issue warnings rather than fatal
1963Like B<-T>, but taint checks will issue warnings rather than fatal
2015errors. These warnings can now be controlled normally with C<no warnings
1964errors. These warnings can be controlled normally with C<no warnings
20161965qw(taint)>.
20171966
20181967=end original
20191968
2020L</-T> と同様ですが、汚染チェックは致命的エラーではなく警告を発生させます。
1969B<-T> と同様ですが、汚染チェックは致命的エラーではなく警告を発生させます。
20211970この警告は通常通り C<no warnings qw(taint)> で制御できます。
20221971
20231972=begin original
20241973
2025B<Note: This is not a substitute for C<-T>!> This is meant to be
1974B<NOTE: this is not a substitute for -T.> This is meant only to be
2026used I<only> as a temporary development aid while securing legacy code:
1975used as a temporary development aid while securing legacy code:
2027for real production code and for new secure code written from scratch,
1976for real production code and for new secure code written from scratch
2028always use the real L</-T>.
1977always use the real B<-T>.
20291978
20301979=end original
20311980
2032B<注意: これは C<-T> の代用品ではありません!>
1981B<注意: これは -T の代用品ではありません>
2033これは昔のコードを安全にするのを助けるために一時的に使用されるため
1982これは昔のコードを安全にするのを助けるために一時的に使用されるためだけの
2034I<だけの> ものです:
1983ものです:
20351984本当の製品版コードと最初から書く安全なコードのためには常に本当の
2036L</-T> を使ってください。
1985B<-T> を使ってください。
20371986
2038=begin original
2039
2040This has no effect if your perl was built without taint support.
2041
2042=end original
2043
2044これは perl 汚染チェック対応なしでビルドされている場合は
2045何の効果もありません。
2046
20471987=item B<-T>
20481988X<-T>
20491989
20501990=begin original
20511991
2052turns on "taint" so you can test them. Ordinarily
1992forces "taint" checks to be turned on so you can test them. Ordinarily
20531993these checks are done only when running setuid or setgid. It's a
20541994good idea to turn them on explicitly for programs that run on behalf
20551995of someone else whom you might not necessarily trust, such as CGI
20561996programs or any internet servers you might write in Perl. See
20571997L<perlsec> for details. For security reasons, this option must be
20581998seen by Perl quite early; usually this means it must appear early
2059on the command line or in the C<#!> line for systems which support
1999on the command line or in the #! line for systems which support
20602000that construct.
20612001
20622002=end original
20632003
20642004「汚染」チェックをオンにして、テストできるようにします。
20652005通常、このチェックは setuid や setgid のスクリプトを実行するときにだけ、
20662006行なわれます。
20672007CGI プログラムやインターネットサーバーを Perl で書くときのように、
20682008信用できるとは限らない人が動かすようなプログラムではこれを明示的に
20692009有効にするのはいい考えです。
20702010詳細については L<perlsec> を参照してください。
20712011セキュリティ上の理由から、このオプションは Perl にかなり早く
2072渡さなければなりません; これは通常コマンドラインの最初の方につけるか、
2012渡さなければなりません
2073C<#!> 構造に対応するシステムではここに書くかです。
2013これは通常コマンドラインの最初の方につけるか、#! 構造に対応する
2014システムではここに書くかです。
20742015
20752016=item B<-u>
20762017X<-u>
20772018
20782019=begin original
20792020
2080This switch causes Perl to dump core after compiling your
2021This obsolete switch causes Perl to dump core after compiling your
20812022program. You can then in theory take this core dump and turn it
2082into an executable file by using the I<undump> program (not supplied).
2023into an executable file by using the B<undump> program (not supplied).
20832024This speeds startup at the expense of some disk space (which you
20842025can minimize by stripping the executable). (Still, a "hello world"
20852026executable comes out to about 200K on my machine.) If you want to
2086execute a portion of your program before dumping, use the C<CORE::dump()>
2027execute a portion of your program before dumping, use the dump()
2087function instead. Note: availability of I<undump> is platform
2028operator instead. Note: availability of B<undump> is platform
20882029specific and may not be available for a specific port of Perl.
20892030
20902031=end original
20912032
2092このスイッチはプログラムのコンパイル後、コアダンプを
2033この古いスイッチはプログラムのコンパイル後、コアダンプを
20932034行なうようにします。
20942035理論的には、このコアダンプを持ってきて(Perl の配布では提供されていませんが)
2095I<undump> プログラムを使って、実行ファイルに変換することができます。
2036B<undump> プログラムを使って、実行ファイルに変換することができます。
20962037これは多少ディスク容量を食いますが (実行ファイルを strip することで
20972038少しは減ります)、実行開始を速くすることができます。
20982039(減らしても、"hello world" の実行ファイルは、私のマシンで 200K 程に
20992040なります。)
21002041ダンプする前に部分的にプログラムを実行しておきたい場合には、
2101このスイッチの代わりに C<CORE::dump()> 関数を使ってください。
2042このスイッチの代わりに dump() 演算子を使ってください。
2102注意: I<undump> が実行できるのは特定の環境下ですし、
2043注意:B<undump> が実行できるのは特定の環境下ですし、
21032044これが使えない移植バージョンの Perl もあるでしょう。
21042045
21052046=item B<-U>
21062047X<-U>
21072048
21082049=begin original
21092050
21102051allows Perl to do unsafe operations. Currently the only "unsafe"
2111operations are attempting to unlink directories while running as superuser
2052operations are attempting to unlink directories while running as
2112and running setuid programs with fatal taint checks turned into warnings.
2053superuser, and running setuid programs with fatal taint checks turned
2113Note that warnings must be enabled along with this option to actually
2054into warnings. Note that the B<-w> switch (or the C<$^W> variable)
2114I<generate> the taint-check warnings.
2055must be used along with this option to actually I<generate> the
2056taint-check warnings.
21152057
21162058=end original
21172059
21182060Perl に安全でない操作を許可します。
2119現在のところ唯一の「安全でない」操作はスーパーユーザとして実行されている
2061現在のところ「安全でない」操作スーパーユーザとして実行中に
2120ときにディレクトリを削除しようとすることと、致命的な汚染チェックを
2062ディレクトリを削除しようとすることと、致命的な汚染チェックを警告に替えて、
2121警告に変更して setuid プログラムを実行することです。
2063setuid プログラムを実行することです。
2122このオプション実際に汚染チェック警告が I<生成される> とき
2064B<-w> スイッチ(あるい C<$^W> 変数)は汚染チェック警告が実際
2123有効でなければならないことに注意してください
2065I<生成される> ためにこのオプションと共に使われなければなりません
21242066
21252067=item B<-v>
21262068X<-v>
21272069
21282070=begin original
21292071
21302072prints the version and patchlevel of your perl executable.
21312073
21322074=end original
21332075
21342076Perl 実行ファイルのバージョンとパッチレベルを表示します。
21352077
21362078=item B<-V>
21372079X<-V>
21382080
21392081=begin original
21402082
21412083prints summary of the major perl configuration values and the current
21422084values of @INC.
21432085
21442086=end original
21452087
21462088Perl の主な設定値と @INC の現在の値を表示します。
21472089
21482090=item B<-V:>I<configvar>
21492091
21502092=begin original
21512093
21522094Prints to STDOUT the value of the named configuration variable(s),
2153with multiples when your C<I<configvar>> argument looks like a regex (has
2095with multiples when your configvar argument looks like a regex (has
21542096non-letters). For example:
21552097
21562098=end original
21572099
21582100指定された設定変数の値を STDOUT に表示します;
2159C<I<configvar>> 引数が正規表現のように見えるもの(英字以外を含んでいる)の
2101configvar 引数が正規表現のように見えるもの(英字以外を含んでいる)の場合は
2160場合は複数表示します。
2102複数表示します。
21612103例えば:
21622104
21632105 $ perl -V:libc
21642106 libc='/lib/libc-2.2.4.so';
21652107 $ perl -V:lib.
21662108 libs='-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc';
21672109 libc='/lib/libc-2.2.4.so';
21682110 $ perl -V:lib.*
21692111 libpth='/usr/local/lib /lib /usr/lib';
21702112 libs='-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc';
21712113 lib_ext='.a';
21722114 libc='/lib/libc-2.2.4.so';
21732115 libperl='libperl.a';
21742116 ....
21752117
21762118=begin original
21772119
21782120Additionally, extra colons can be used to control formatting. A
2179trailing colon suppresses the linefeed and terminator ";", allowing
2121trailing colon suppresses the linefeed and terminator ';', allowing
21802122you to embed queries into shell commands. (mnemonic: PATH separator
2181":".)
2123':'.)
21822124
21832125=end original
21842126
21852127さらに、追加のコロンはフォーマットの制御に使います。
2186末尾のコロンは改行と終端子 ";" を抑制し、シェルコマンド中にクエリを
2128末尾のコロンは改行と終端子 ';' を抑制し、シェルコマンド中にクエリを
21872129組み込めるようにします。
2188(記憶法: PATH セパレータ ":"。)
2130(記憶法: PATH セパレータ ':'。)
21892131
21902132 $ echo "compression-vars: " `perl -V:z.*: ` " are here !"
21912133 compression-vars: zcat='' zip='zip' are here !
21922134
21932135=begin original
21942136
2195A leading colon removes the "name=" part of the response, this allows
2137A leading colon removes the 'name=' part of the response, this allows
21962138you to map to the name you need. (mnemonic: empty label)
21972139
21982140=end original
21992141
2200先頭のコロンはレスポンスの "name=" の部分を削除し、必要な名前に
2142先頭のコロンはレスポンスの 'name=' の部分を削除し、必要な名前に
22012143マッピングできるようにします。
22022144(記憶法: 空ラベル)
22032145
22042146 $ echo "goodvfork="`./perl -Ilib -V::usevfork`
22052147 goodvfork=false;
22062148
22072149=begin original
22082150
22092151Leading and trailing colons can be used together if you need
22102152positional parameter values without the names. Note that in the case
2211below, the C<PERL_API> params are returned in alphabetical order.
2153below, the PERL_API params are returned in alphabetical order.
22122154
22132155=end original
22142156
22152157もし位置パラメータの値を名前なしで必要なら、先頭のコロンと末尾のコロンを
22162158両方使えます。
2217以下の場合、C<PERL_API> パラメータはアルファベット順に返されることに
2159以下の場合、PERL_API パラメータはアルファベット順に返されることに
22182160注意してください。
22192161
22202162 $ echo building_on `perl -V::osname: -V::PERL_API_.*:` now
22212163 building_on 'linux' '5' '1' '9' now
22222164
22232165=item B<-w>
22242166X<-w>
22252167
22262168=begin original
22272169
22282170prints warnings about dubious constructs, such as variable names
2229mentioned only once and scalar variables used
2171that are mentioned only once and scalar variables that are used
2230before being set; redefined subroutines; references to undefined
2172before being set, redefined subroutines, references to undefined
2231filehandles; filehandles opened read-only that you are attempting
2173filehandles or filehandles opened read-only that you are attempting
2232to write on; values used as a number that don't I<look> like numbers;
2174to write on, values used as a number that don't look like numbers,
2233using an array as though it were a scalar; if your subroutines
2175using an array as though it were a scalar, if your subroutines
2234recurse more than 100 deep; and innumerable other things.
2176recurse more than 100 deep, and innumerable other things.
22352177
22362178=end original
22372179
223821801 度しか使われない変数名、設定される前に使われている変数、サブルーチンの
22392181再定義、未定義のファイルハンドルの参照や、読み込み専用でオープンした
2240ファイルハンドルへの書き込み、数値に I<見えない> 値を数値として使った場合、
2182ファイルハンドルへの書き込み、数値に見えない値を数値として使った場合、
22412183配列をスカラであるかのように使った場合、100 段階以上のサブルーティンの再帰、
22422184その他たくさんの疑わしい事に警告を出します。
22432185
22442186=begin original
22452187
2246This switch really just enables the global C<$^W> variable; normally,
2188This switch really just enables the internal C<$^W> variable. You
2247the lexically scoped C<use warnings> pragma is preferred. You
22482189can disable or promote into fatal errors specific warnings using
22492190C<__WARN__> hooks, as described in L<perlvar> and L<perlfunc/warn>.
2250See also L<perldiag> and L<perltrap>. A fine-grained warning
2191See also L<perldiag> and L<perltrap>. A new, fine-grained warning
22512192facility is also available if you want to manipulate entire classes
2252of warnings; see L<warnings>.
2193of warnings; see L<warnings> or L<perllexwarn>.
22532194
22542195=end original
22552196
2256このスイッチは実際にはグローバルな C<$^W> 変数を有効にするだけです;
2197このスイッチは実際には内部の C<$^W> 変数を有効にするだけです
2257普通は、レキシカルスコープの C<use warnings> グマが推奨されます。
2198C<__WARN__> フックを使って特定の警告を無効にしたり致命的エーに
2258C<__WARN__> フックを使って特定の警告を無効にしたり致命的エラーにしたり
2199したりできます。
2259できます; これについては L<perlvar> と L<perlfunc/warn> を参照してください。
2200これについては L<perlvar> と L<perlfunc/warn> を参照してさい。
2260L<perldiag> と L<perltrap> も参照してください。
2201L<perldiag> と L<perltrap> も参照してさい。
2261もし警告のクラス全体を操作したいなら、粒度の細かい警告機能もあります;
2202もし警告のクラス全体を操作したいなら、新しく粒度の細かい
2262L<warnings> を参照してください
2203警告機能もあります
2204L<warnings> や L<perllexwarn> を参照して下さい。
22632205
22642206=item B<-W>
22652207X<-W>
22662208
22672209=begin original
22682210
22692211Enables all warnings regardless of C<no warnings> or C<$^W>.
2270See L<warnings>.
2212See L<perllexwarn>.
22712213
22722214=end original
22732215
22742216C<no warnings> や C<$^W> の設定に関わらず全ての警告を有効にします。
2275L<warnings> を参照してください。
2217L<perllexwarn> を参照してさい。
22762218
22772219=item B<-X>
22782220X<-X>
22792221
22802222=begin original
22812223
22822224Disables all warnings regardless of C<use warnings> or C<$^W>.
2283See L<warnings>.
2225See L<perllexwarn>.
22842226
22852227=end original
22862228
22872229C<use warnings> や C<$^W> の設定に関わらず全ての警告を無効にします。
2288L<warnings> を参照してください。
2230L<perllexwarn> を参照してさい。
22892231
2290=begin original
2291
2292Forbidden in C<L</PERL5OPT>>.
2293
2294=end original
2295
2296C<L</PERL5OPT>> では禁止されています。
2297
22982232=item B<-x>
22992233X<-x>
23002234
23012235=item B<-x>I<directory>
23022236
23032237=begin original
23042238
23052239tells Perl that the program is embedded in a larger chunk of unrelated
2306text, such as in a mail message. Leading garbage will be
2240ASCII text, such as in a mail message. Leading garbage will be
2307discarded until the first line that starts with C<#!> and contains the
2241discarded until the first line that starts with #! and contains the
23082242string "perl". Any meaningful switches on that line will be applied.
23092243
23102244=end original
23112245
2312メールのような大きな無関係のテキストのかたまりの中にプログラムが
2246メールのような大きな無関係のASCII テキストのかたまりの中にプログラムが
23132247埋め込まれている事を Perl に伝えます。
2314最初の C<#!> で始まり、"perl" という文字列を含む行までの、先行するゴミは
2248最初の #! で始まり、"perl" という文字列を含む行までの、先行するゴミは
23152249捨てられます。
23162250その行にある意味を持つスイッチは適用されます。
23172251
23182252=begin original
23192253
23202254All references to line numbers by the program (warnings, errors, ...)
2321will treat the C<#!> line as the first line.
2255will treat the #! line as the first line.
2322Thus a warning on the 2nd line of the program, which is on the 100th
2256Thus a warning on the 2nd line of the program (which is on the 100th
2323line in the file will be reported as line 2, not as line 100.
2257line in the file) will be reported as line 2, and not as line 100.
2324This can be overridden by using the C<#line> directive.
2258This can be overridden by using the #line directive.
2325(See L<perlsyn/"Plain Old Comments (Not!)">)
2259(See L<perlsyn/"Plain-Old-Comments-(Not!)">)
23262260
23272261=end original
23282262
2329プログラムによる行番号への全ての参照 (警告、エラー…) は C<#!> 行を
2263プログラムによる行番号への全ての参照 (警告、エラー…) は #! 行を
23302264最初の行として扱います。
23312265従って、プログラムの 2 番目の行 (ファイルとしては 100 行目) での警告は
23322266100 行目ではなく 2 行目として報告されます。
2333これは C<#line> 指示子を使って上書きできます。
2267これは #line 指示子を使って上書きできます。
2334(L<perlsyn/"Plain Old Comments (Not!)"> を参照してください)
2268(L<perlsyn/"Plain-Old-Comments-(Not!)"> を参照してください)
23352269
23362270=begin original
23372271
23382272If a directory name is specified, Perl will switch to that directory
23392273before running the program. The B<-x> switch controls only the
23402274disposal of leading garbage. The program must be terminated with
2341C<__END__> if there is trailing garbage to be ignored; the program
2275C<__END__> if there is trailing garbage to be ignored (the program
2342can process any or all of the trailing garbage via the C<DATA> filehandle
2276can process any or all of the trailing garbage via the DATA filehandle
2343if desired.
2277if desired).
23442278
23452279=end original
23462280
2347ディレクトリ名が指定されると、Perl はプログラムの実行前にそのディレクトリに
2281directory が指定されると、Perl はプログラムの実行前にそのディレクトリに
2348変更します。
2282移ります。
2349B<-x> オプション前に付いていごみを捨てることを制御します。
2283C<-x> スイッチ先行すゴミ処分を制御するだけです。
2350もしに無視する必要のあるごみが付いているなら、プログラム C<__END__> で
2284プログラムの後に無視すべきゴミがある場合にC<__END__> でプログラムを
2351終了していなければなりません; もし望むならC<DATA> ファイルハンドル経由で
2285終了する必要がありま (その後に続くゴミの一部または全部は、必要に応じて
2352後ろに付いいるごみ一部または全てをプログラムで処理できます。
2286DATA ファイルハンドルを通し、そのプログラムで処理する事ができます)
23532287
23542288=begin original
23552289
23562290The directory, if specified, must appear immediately following the B<-x>
23572291with no intervening whitespace.
23582292
23592293=end original
23602294
23612295ディレクトリが指定される場合は、これは B<-x> の直後、空白なしに
23622296引き続かなければなりません。
23632297
23642298=back
23652299
23662300=head1 ENVIRONMENT
23672301X<perl, environment variables>
23682302
23692303(環境変数)
23702304
23712305=over 12
23722306
23732307=item HOME
23742308X<HOME>
23752309
23762310=begin original
23772311
2378Used if C<chdir> has no argument.
2312Used if chdir has no argument.
23792313
23802314=end original
23812315
2382C<chdir> の引数がないときに使われます。
2316chdir の引数がないときに使われます。
23832317
23842318=item LOGDIR
23852319X<LOGDIR>
23862320
23872321=begin original
23882322
2389Used if C<chdir> has no argument and L</HOME> is not set.
2323Used if chdir has no argument and HOME is not set.
23902324
23912325=end original
23922326
2393C<chdir> の引数がなく、L</HOME> がセットされていないときに使われます。
2327chdir の引数がなく、HOME がセットされていないときに使われます。
23942328
23952329=item PATH
23962330X<PATH>
23972331
23982332=begin original
23992333
2400Used in executing subprocesses, and in finding the program if L</-S> is
2334Used in executing subprocesses, and in finding the program if B<-S> is
24012335used.
24022336
24032337=end original
24042338
2405サブプロセスを実行するときと、L</-S> が指定されたときにプログラムを
2339サブプロセスを実行するときと、B<-S> が指定されたときにプログラムを
24062340探すのに使われます。
24072341
24082342=item PERL5LIB
24092343X<PERL5LIB>
24102344
24112345=begin original
24122346
2413A list of directories in which to look for Perl library files before
2347A list of directories in which to look for Perl library
2414looking in the standard library.
2348files before looking in the standard library and the current
2415Any architecture-specific and version-specific directories,
2349directory. Any architecture-specific directories under the specified
2416such as F<version/archname/>, F<version/>, or F<archname/> under the
2350locations are automatically included if they exist (this lookup
2417specified locations are automatically included if they exist, with this
2351being done at interpreter startup time.)
2418lookup done at interpreter startup time. In addition, any directories
2419matching the entries in C<$Config{inc_version_list}> are added.
2420(These typically would be for older compatible perl versions installed
2421in the same directory tree.)
24222352
24232353=end original
24242354
2425Perl のライブラリファイルを探すときに標準ライブラリ
2355Perl のライブラリファイルを探すときに標準ライブラリディレクトリと
2426探す前に探すディレクトリのリストです。
2356カレントディレクトリを探す前に探すディレクトリのリストです。
2427特定の場所における F<version/archname/>, F<version/>, F<archname/> ような
2357特定の場所におけるアーキテクチャ依存ディレクトリは、もしあれば自動的に
2428アーキテクチャ依存とバージョン依存ディレクトリ、もしあれば自
2358追加されます(こ検索インタプリタ起行われます)。
2429追加されます; この検索はインタプリタ起動時に行われます。
2430さらに、C<$Config{inc_version_list}> のエントリにマッチングするディレクトリが
2431追加されます。
2432(これらは典型的には同じディレクトリツリーにより古い互換性のある perl が
2433インストールされている場合のためのものです。)
24342359
24352360=begin original
24362361
2437If PERL5LIB is not defined, L</PERLLIB> is used. Directories are separated
2362If PERL5LIB is not defined, PERLLIB is used. Directories are separated
2438(like in PATH) by a colon on Unixish platforms and by a semicolon on
2363(like in PATH) by a colon on unixish platforms and by a semicolon on
24392364Windows (the proper path separator being given by the command C<perl
2440-V:I<path_sep>>).
2365-V:path_sep>).
24412366
24422367=end original
24432368
2444PERL5LIB が定義されていなければ、L</PERLLIB> が使われます。
2369PERL5LIB が定義されていなければ、PERLLIB が使われます。
2445ディレクトリは(PATH と同様に)Unix 風のプラットフォームではコロンで区切られ、
2370ディレクトリは(PATH と同様に)unix 風のプラットフォームではコロンで区切られ、
24462371Windows ではセミコロンで区切られます(適切なパス区切り文字は
24472372C<perl -V:path_sep> コマンドでわかります)。
24482373
24492374=begin original
24502375
2451When running taint checks, either because the program was running setuid or
2376When running taint checks (either because the program was running setuid
2452setgid, or the L</-T> or L</-t> switch was specified, neither PERL5LIB nor
2377or setgid, or the B<-T> or B<-t> switch was specified), neither variable
2453L</PERLLIB> is consulted. The program should instead say:
2378is used. The program should instead say:
24542379
24552380=end original
24562381
2457プログラムが setuid または setgid で実行されているか、L</-T> または L</-t> の
2382(プログラムが setuid または setgid で実行されているか、B<-T> B<-t> の
2458スイッチが指定されて汚染チェック付きで動作している場合、PERL5LIB
2383スイッチが指定されて)汚染チェック付きで動作している場合、どちらの環境変数
2459L</PERLLIB> も使われません。
2384使われません。
24602385代わりにプログラム中で以下のようにするべきです:
24612386
24622387 use lib "/my/directory";
24632388
24642389=item PERL5OPT
24652390X<PERL5OPT>
24662391
24672392=begin original
24682393
2469Command-line options (switches). Switches in this variable are treated
2394Command-line options (switches). Switches in this variable are taken
2470as if they were on every Perl command line. Only the B<-[CDIMTUWdmtw]>
2395as if they were on every Perl command line. Only the B<-[CDIMUdmtw]>
2471switches are allowed. When running taint checks (either because the
2396switches are allowed. When running taint checks (because the program
2472program was running setuid or setgid, or because the L</-T> or L</-t>
2397was running setuid or setgid, or the B<-T> switch was used), this
2473switch was used), this variable is ignored. If PERL5OPT begins with
2398variable is ignored. If PERL5OPT begins with B<-T>, tainting will be
2474B<-T>, tainting will be enabled and subsequent options ignored. If
2399enabled, and any subsequent options ignored.
2475PERL5OPT begins with B<-t>, tainting will be enabled, a writable dot
2476removed from @INC, and subsequent options honored.
24772400
24782401=end original
24792402
24802403コマンドラインオプション(スイッチ)です。
24812404この変数のスイッチは全ての Perl コマンドラインで指定されたかのように
24822405扱われます。
2483B<-[CDIMTUWdmtw]> オプションのみが有効です。
2406B<-[CDIMUdmtw]> オプションのみが有効です。
2484(プログラムが setuid または setgid で実行されているか、
2407(プログラムが setuid または setgid で実行されているか、B<-T> スイッチが
2485L</-T> または L</-t> スイッチが指定されて)汚染チェック付きで動作している場合、
2408指定されて)汚染チェック付きで動作している場合、この変数は無視されます。
2486この変数は無視されす。
2409PERL5OPT が B<-T> で始っている場合、汚染チェックが有効となり、残りの
2487PERL5OPT が B<-T> で始まっている場合、汚染チェックが有効となり、引き続く
24882410オプションは無視されます。
2489PERL5OPT が B<-t> で始まっている場合、汚染チェックが有効となり、
2490書き込み可能なドットは @INC から削除され、引き続くオプションも有効に
2491なります。
24922411
24932412=item PERLIO
24942413X<PERLIO>
24952414
24962415=begin original
24972416
24982417A space (or colon) separated list of PerlIO layers. If perl is built
2499to use PerlIO system for IO (the default) these layers affect Perl's IO.
2418to use PerlIO system for IO (the default) these layers effect perl's IO.
25002419
25012420=end original
25022421
25032422空白(またはコロン)で区切られた PerlIO 層のリストです。
25042423perl が IO に PerlIO システムを使うようにコンパイルされている場合
25052424(これがデフォルトです)、これらの層が perl の IO に影響を与えます。
25062425
25072426=begin original
25082427
2509It is conventional to start layer names with a colon (for example, C<:perlio>) to
2428It is conventional to start layer names with a colon e.g. C<:perlio> to
2510emphasize their similarity to variable "attributes". But the code that parses
2429emphasise their similarity to variable "attributes". But the code that parses
2511layer specification strings, which is also used to decode the PERLIO
2430layer specification strings (which is also used to decode the PERLIO
2512environment variable, treats the colon as a separator.
2431environment variable) treats the colon as a separator.
25132432
25142433=end original
25152434
2516層名をコロンで始める (例えば C<:perlio>)は、変数の「属性」との
2435変数"属性"との類似性を強調するために層名を C<:perlio> のようにコロンで
2517類似性を強調するた慣習す。
2436慣習があります。
2518しかし層定文字列パースするコード(PERLIO 環境変数をデコードするためにも
2437しかしプログラムは義する文字列パースする
2519使われます)は、コロンを区切りとして使います。
2438(PERLIO 環境変数のデコードにも使われます)ときにコロンをセパレータとして
2439扱います。
25202440
25212441=begin original
25222442
25232443An unset or empty PERLIO is equivalent to the default set of layers for
2524your platform; for example, C<:unix:perlio> on Unix-like systems
2444your platform, for example C<:unix:perlio> on UNIX-like systems
25252445and C<:unix:crlf> on Windows and other DOS-like systems.
25262446
25272447=end original
25282448
25292449PERLIO をセットしない、または空文字列をセットすると、プラットフォームの
25302450デフォルトの層の組み合わせと等価です;
2531例えば、Unix 風のシステムでは C<:unix:perlio> で、Windows やその他の
2451例えば、UNIX 風のシステムでは C<:unix:perlio> で、Windows やその他の
25322452DOS 風のシステムは C<:unix:crlf> です。
25332453
25342454=begin original
25352455
2536The list becomes the default for I<all> Perl's IO. Consequently only built-in
2456The list becomes the default for I<all> perl's IO. Consequently only built-in
2537layers can appear in this list, as external layers (such as C<:encoding()>) need
2457layers can appear in this list, as external layers (such as :encoding()) need
2538IO in order to load them! See L<"open pragma"|open> for how to add external
2458IO in order to load them!. See L<"open pragma"|open> for how to add external
25392459encodings as defaults.
25402460
25412461=end original
25422462
2543このリストは I<全ての> Perl の IO のデフォルトとなります。
2463このリストは I<全ての> perl の IO のデフォルトとなります。
2544従って組み込みの層のみがこのリストに記述可能です; なぜなら
2464従って組み込みの層のみがこのリストに記述可能です
2545(C<:encoding()> のような)外部読み込みの層はロードするために
2465なぜなら(:encoding() のような)外部読み込みの層はロードするために
2546IO が必要だからです!
2466IO が必要だからです
25472467デフォルトとして外部エンコーディングを追加する方法については
25482468L<"open pragma"|open> を参照してください。
25492469
25502470=begin original
25512471
2552Layers it makes sense to include in the PERLIO environment
2472The layers that it makes sense to include in the PERLIO environment
2553variable are briefly summarized below. For more details see L<PerlIO>.
2473variable are briefly summarised below. For more details see L<PerlIO>.
25542474
25552475=end original
25562476
25572477PERLIO 環境変数に加えることが妥当な層の簡単な一覧を以下に示します。
25582478詳細については L<PerlIO> を参照してください。
25592479
25602480=over 8
25612481
2482=item :bytes
2483X<:bytes>
2484
2485=begin original
2486
2487A pseudolayer that turns I<off> the C<:utf8> flag for the layer below.
2488Unlikely to be useful on its own in the global PERLIO environment variable.
2489You perhaps were thinking of C<:crlf:bytes> or C<:perlio:bytes>.
2490
2491=end original
2492
2493以下に示す C<:utf8> フラグを I<無効にする> ための擬似層です。
2494グローバルな PERLIO 環境変数にこれを含めるのが有用な場合は
2495ありそうもないです。
2496おそらく C<:crlf:bytes> か C<:perlio:bytes> のことを考えているのでしょう。
2497
25622498=item :crlf
25632499X<:crlf>
25642500
25652501=begin original
25662502
2567A layer which does CRLF to C<"\n"> translation distinguishing "text" and
2503A layer which does CRLF to "\n" translation distinguishing "text" and
2568"binary" files in the manner of MS-DOS and similar operating systems,
2504"binary" files in the manner of MS-DOS and similar operating systems.
2569and also provides buffering similar to C<:perlio> on these architectures.
2505(It currently does I<not> mimic MS-DOS as far as treating of Control-Z
2506as being an end-of-file marker.)
25702507
25712508=end original
25722509
2573"テキスト"と"バイナリ"ファイルを識別する CRLF から C<"\n"> への変換を
2510"テキスト"と"バイナリ"ファイルを識別する CRLF から "\n" への変換を
2574MS-DOS 及び似たようなオペレーティングシステムの方式で行
2511MS-DOS 及び似たようなオペレーティングシステムの方式で行う層です。
2575それらアーキテクチャの C<:perlio> と同様のバッファリングを提供る層す。
2512(現在ところ Control-Z ファイルの終わりと見なところま MS-DOS を
2513まねてはいません。)
25762514
2515=item :mmap
2516X<:mmap>
2517
2518=begin original
2519
2520A layer which implements "reading" of files by using C<mmap()> to
2521make (whole) file appear in the process's address space, and then
2522using that as PerlIO's "buffer".
2523
2524=end original
2525
2526ファイルの"読み込み"に C<mmap()> を使ってファイル(全体)をプロセスの
2527アドレス空間に割り当て、それを PerlIO の"バッファ"として使うための層です。
2528
25772529=item :perlio
25782530X<:perlio>
25792531
25802532=begin original
25812533
2582This is a re-implementation of stdio-like buffering written as a
2534This is a re-implementation of "stdio-like" buffering written as a
2583PerlIO layer. As such it will call whatever layer is below it for
2535PerlIO "layer". As such it will call whatever layer is below it for
2584its operations, typically C<:unix>.
2536its operations (typically C<:unix>).
25852537
25862538=end original
25872539
2588これは stdio 風のバッファリングを PerlIO 層として再実装したものです。
2540これは"stdio風"のバッファリングを PerlIO "" として再実装したものです。
25892541従ってどのような層からも操作時に呼び出されます(典型的には C<:unix>)。
25902542
2543=item :pop
2544X<:pop>
2545
2546=begin original
2547
2548An experimental pseudolayer that removes the topmost layer.
2549Use with the same care as is reserved for nitroglycerin.
2550
2551=end original
2552
2553先頭の層を除去するための実験的な擬似層です。
2554ニトログリセリンに対するのと同様の慎重さを持って使ってください。
2555
2556=item :raw
2557X<:raw>
2558
2559=begin original
2560
2561A pseudolayer that manipulates other layers. Applying the C<:raw>
2562layer is equivalent to calling C<binmode($fh)>. It makes the stream
2563pass each byte as-is without any translation. In particular CRLF
2564translation, and/or :utf8 intuited from locale are disabled.
2565
2566=end original
2567
2568他の層を操作するための擬似層です。
2569 C<:raw> 層を適用することは C<binmode($fh)> を呼び出すのと等価です。
2570これはストリームの各バイトを何の変換もなしに通過させます。
2571特に CRLF 変換やロケールからの :utf8 が無効になります。
2572
2573=begin original
2574
2575Unlike in the earlier versions of Perl C<:raw> is I<not>
2576just the inverse of C<:crlf> - other layers which would affect the
2577binary nature of the stream are also removed or disabled.
2578
2579=end original
2580
2581昔のバージョンの Perl と異なり、C<:raw> は C<:crlf> の逆
2582I<ではありません> - ストリームのバイナリの性質に影響を与える
2583その他の層も除去されるか無効になります。
2584
25912585=item :stdio
25922586X<:stdio>
25932587
25942588=begin original
25952589
2596This layer provides a PerlIO interface by wrapping system's ANSI C "stdio"
2590This layer provides PerlIO interface by wrapping system's ANSI C "stdio"
25972591library calls. The layer provides both buffering and IO.
2598Note that the C<:stdio> layer does I<not> do CRLF translation even if that
2592Note that C<:stdio> layer does I<not> do CRLF translation even if that
2599is the platform's normal behaviour. You will need a C<:crlf> layer above it
2593is platforms normal behaviour. You will need a C<:crlf> layer above it
26002594to do that.
26012595
26022596=end original
26032597
26042598この層はシステムの ANSI C "stdio" ライブラリコールをラップした
26052599PerlIO インターフェースを提供します。
26062600この層はバッファリングと IO の両方を提供します。
2607C<:stdio> 層は CRLF 変換を I<行わない> ことに注意してください; たとえそれが
2601C<:stdio> 層は CRLF 変換を I<行わない> ことに注意してください
2608プラットフォームの通常の振る舞いであっても、です。
2602たとえそれがプラットフォームの通常の振る舞いであっても、です。
26092603これを行うためには C<:crlf> 層が必要です。
26102604
26112605=item :unix
26122606X<:unix>
26132607
26142608=begin original
26152609
2616Low-level layer that calls C<read>, C<write>, C<lseek>, etc.
2610Low level layer which calls C<read>, C<write> and C<lseek> etc.
26172611
26182612=end original
26192613
26202614C<read>, C<write>, C<lseek> などを呼び出す低レベル層です。
26212615
2616=item :utf8
2617X<:utf8>
2618
2619=begin original
2620
2621A pseudolayer that turns on a flag on the layer below to tell perl
2622that output should be in utf8 and that input should be regarded as
2623already in valid utf8 form. It does not check for validity and as such
2624should be handled with caution for input. Generally C<:encoding(utf8)> is
2625the best option when reading UTF-8 encoded data.
2626
2627=end original
2628
2629出力が utf8 で、入力は既に妥当な utf8 の形になっていると下位の層に伝える
2630フラグをオンにする擬似層です。
2631妥当性についてはチェックされないので、入力については注意して扱うべきです。
2632一般的に、UTF-8 でエンコードされたデータを読むときには C<:encoding(utf8)> が
2633最善の選択肢です。
2634
2635=item :win32
2636X<:win32>
2637
2638=begin original
2639
2640On Win32 platforms this I<experimental> layer uses native "handle" IO
2641rather than unix-like numeric file descriptor layer. Known to be
2642buggy in this release.
2643
2644=end original
2645
2646Win32 プラットフォームにおいて、この I<実験的> 層は unix 風の数値の
2647ファイル記述子層の代わりにネイティブな "ハンドル" IO を使用します。
2648このリリースではバグっぽいことがわかっています。
2649
26222650=back
26232651
26242652=begin original
26252653
2626The default set of layers should give acceptable results on all platforms.
2654On all platforms the default set of layers should give acceptable results.
26272655
26282656=end original
26292657
26302658全てのプラットフォームでデフォルトの層の組み合わせは納得できる結果に
26312659なっているはずです。
26322660
26332661=begin original
26342662
2635For Unix platforms that will be the equivalent of ":unix:perlio" or ":stdio".
2663For UNIX platforms that will equivalent of "unix perlio" or "stdio".
2636Configure is set up to prefer the ":stdio" implementation if the system's library
2664Configure is setup to prefer "stdio" implementation if system's library
2637provides for fast access to the buffer (not common on modern architectures);
2665provides for fast access to the buffer, otherwise it uses the "unix perlio"
2638otherwise, it uses the ":unix:perlio" implementation.
2666implementation.
26392667
26402668=end original
26412669
2642Unix プラットフォームではこれは ":unix:perlio" または ":stdio" と等価です。
2670UNIX プラットフォームではこれは "unix perlio" または "stdio" と等価です。
2643Configure スクリプトはシステムのライブラリがバッファへの高速アクセス方法を
2671configure スクリプトはシステムのライブラリがバッファへの高速アクセス方法を
2644提供する場合 (最近のアーキテクチャで一般的はありません)
2672提供する場合は"stdio"実装を使うよう設定し、そうなければ"unix perlio"
2645":stdio" 実装を使うよう設定します; そうでなければ
2673実装を使ます
2646":unix:perlio" 実装を使います。
26472674
26482675=begin original
26492676
2650On Win32 the default in this release (5.30) is ":unix:crlf". Win32's ":stdio"
2677On Win32 the default in this release is "unix crlf". Win32's "stdio"
2651has a number of bugs/mis-features for Perl IO which are somewhat depending
2678has a number of bugs/mis-features for perl IO which are somewhat
2652on the version and vendor of the C compiler. Using our own C<:crlf> layer as
2679C compiler vendor/version dependent. Using our own C<crlf> layer as
26532680the buffer avoids those issues and makes things more uniform.
2681The C<crlf> layer provides CRLF to/from "\n" conversion as well as
2682buffering.
26542683
26552684=end original
26562685
2657このリリース (5.30) では Win32 でデフォルトは":unix:crlf"です。
2686Win32 でデフォルトは"unix crlf"です。
2658Win32 の":stdio" は perl IO にとって、C コンパイラのベンダー/バージョン依存の
2687Win32 の"stdio" は perl IO にとって、C コンパイラのベンダー/バージョン依存の
26592688大量のバグ/仕様漏れがあります。
2660バッファとして自身の C<:crlf> 層を使うことでこれらの問題を回避し、
2689バッファとして自身の C<crlf> 層を使うことでこれらの問題を回避し、
26612690物事をより一貫したものにします。
2691C<crlf> 層はバッファリング時に CRLF と "\n" の変換を行います。
26622692
26632693=begin original
26642694
2665This release (5.30) uses C<:unix> as the bottom layer on Win32, and so still
2695This release uses C<unix> as the bottom layer on Win32 and so still uses C
2666uses the C compiler's numeric file descriptor routines.
2696compiler's numeric file descriptor routines. There is an experimental native
2697C<win32> layer which is expected to be enhanced and should eventually be
2698the default under Win32.
26672699
26682700=end original
26692701
2670このリリース (5.30) では Win32 での基底層として C<:unix> を使うことで、未だに
2702このリリースでは Win32 での基底層として C<unix> を使うことで、未だに
26712703C コンパイラの数値のファイル記述子ルーチンを使います。
2704拡張を予定されている実験的なネイティブの C<win32> 層があり、最終的には
2705これが Win32 でのデフォルトとなる予定です。
26722706
26732707=begin original
26742708
2675The PERLIO environment variable is completely ignored when Perl
2709The PERLIO environment variable is completely ignored when perl
26762710is run in taint mode.
26772711
26782712=end original
26792713
2680PERLIO 環境変数は、Perl が汚染モードで実行されるときには完全に無視されます。
2714PERLIO 環境変数は、perl が汚染モードで実行されるときには完全に無視されます。
26812715
26822716=item PERLIO_DEBUG
26832717X<PERLIO_DEBUG>
26842718
26852719=begin original
26862720
2687If set to the name of a file or device when Perl is run with the
2721If set to the name of a file or device then certain operations of PerlIO
2688L<-Di|/-Dletters> command-line switch, the logging of certain operations
2722sub-system will be logged to that file (opened as append). Typical uses
2689of the PerlIO subsystem will be redirected to the specified file rather
2723are UNIX:
2690than going to stderr, which is the default. The file is opened in append
2691mode. Typical uses are in Unix:
26922724
26932725=end original
26942726
2695Perl が L<-Di|/-Dletters> コマンドラインオプション付きで実行されているときに、
26962727ファイルまたはデバイスの名前をセットすると、PerlIO サブシステムのいくつかの
2697操作のログ、デォルトである stderr ではなく、指定されたファイルに
2728操作がそのファイルに(追記モードで)記録されます。
2698リダイレクトされま
2729UNIX での典型的な使い方は以下の通りで:
2699ファイルは追記モードで記録されます。
2700Unix での典型的な使い方は以下の通りです:
27012730
2702 % env PERLIO_DEBUG=/tmp/perlio.log perl -Di script ...
2731 PERLIO_DEBUG=/dev/tty perl script ...
27032732
27042733=begin original
27052734
2706and under Win32, the approximately equivalent:
2735and Win32 approximate equivalent:
27072736
27082737=end original
27092738
27102739Win32 では以下がほぼ等価です:
27112740
2712 > set PERLIO_DEBUG=CON
2741 set PERLIO_DEBUG=CON
2713 perl -Di script ...
2742 perl script ...
27142743
27152744=begin original
27162745
2717This functionality is disabled for setuid scripts, for scripts run
2746This functionality is disabled for setuid scripts and for scripts run
2718with L</-T>, and for scripts run on a Perl built without C<-DDEBUGGING>
2747with B<-T>.
2719support.
27202748
27212749=end original
27222750
2723この機能は、setuid されたスクリプトや L</-T> で実行されているスクリプト
2751この機能は、setuid されたスクリプトや B<-T> で実行されているスクリプトでは
2724あるいは C<-DDEBUGGING> 対応なしでビルドされた Perl で実行された場合は
27252752無効になります。
27262753
27272754=item PERLLIB
27282755X<PERLLIB>
27292756
27302757=begin original
27312758
27322759A list of directories in which to look for Perl library
2733files before looking in the standard library.
2760files before looking in the standard library and the current directory.
2734If L</PERL5LIB> is defined, PERLLIB is not used.
2761If PERL5LIB is defined, PERLLIB is not used.
27352762
27362763=end original
27372764
2738Perl ライブラリファイルを探すときに標準ライブラリ
2765Perl ライブラリを探すに標準ライブラリとカレントディレクトリの前に
2739前に探すディレクトリのリストです。
2766検索ディレクトリのリストです。
2740L</PERL5LIB> が定義されていると、PERLLIB は使われません。
2767PERL5LIB が定義されていると、PERLLIB は使われません。
27412768
27422769=begin original
27432770
2744The PERLLIB environment variable is completely ignored when Perl
2771The PERLLIB environment variable is completely ignored when perl
27452772is run in taint mode.
27462773
27472774=end original
27482775
2749PERLLIB 環境変数は、Perl が汚染モードで実行されるときには完全に
2776PERLLIB 環境変数は、perl が汚染モードで実行されるときには完全に
27502777無視されます。
27512778
27522779=item PERL5DB
27532780X<PERL5DB>
27542781
27552782=begin original
27562783
27572784The command used to load the debugger code. The default is:
27582785
27592786=end original
27602787
27612788デバッガコードを読み込むのに使われるコマンドです。
27622789デフォルトは以下の通り:
27632790
2764 BEGIN { require "perl5db.pl" }
2791 BEGIN { require 'perl5db.pl' }
27652792
27662793=begin original
27672794
2768The PERL5DB environment variable is only used when Perl is started with
2795The PERL5DB environment variable only used when perl is started with
2769a bare L</-d> switch.
2796a bare B<-d> switch.
27702797
27712798=end original
27722799
2773PERL5DB 環境変数は Perl が裸の L</-d> スイッチで開始されたときにのみ
2800PERL5DB 環境変数は perl が裸の B<-d> スイッチで開始されたときにのみ
27742801使われます。
27752802
27762803=item PERL5DB_THREADED
27772804X<PERL5DB_THREADED>
27782805
27792806=begin original
27802807
27812808If set to a true value, indicates to the debugger that the code being
27822809debugged uses threads.
27832810
27842811=end original
27852812
27862813真の値にセットされると、デバッグするコードがスレッドを使うことをデバッガに
27872814示します。
27882815
27892816=item PERL5SHELL (specific to the Win32 port)
27902817X<PERL5SHELL>
27912818
27922819=begin original
27932820
2794On Win32 ports only, may be set to an alternative shell that Perl must use
2821May be set to an alternative shell that perl must use internally for
2795internally for executing "backtick" commands or system(). Default is
2822executing "backtick" commands or system(). Default is C<cmd.exe /x/d/c>
2796C<cmd.exe /x/d/c> on WindowsNT and C<command.com /c> on Windows95. The
2823on WindowsNT and C<command.com /c> on Windows95. The value is considered
2797value is considered space-separated. Precede any character that
2824to be space-separated. Precede any character that needs to be protected
2798needs to be protected, like a space or backslash, with another backslash.
2825(like a space or backslash) with a backslash.
27992826
28002827=end original
28012828
2802Win32 版だけのもので、
28032829"バッククォート" コマンドや system() を実行するために Perl が内部的に
28042830使わなければならない代替シェルを指定します。
28052831デフォルトは WindowsNT では C<cmd.exe /x/d/c>、Windows95 では
28062832C<command.com /c> です。
28072833値はスペース区切りと考えられます。
2808空白やバックスラッシュのような保護する必要がある文字の前には
2834(空白やバックスラッシュのような) 保護する必要がある文字の前には
28092835バックスラッシュがつけられます。
28102836
28112837=begin original
28122838
28132839Note that Perl doesn't use COMSPEC for this purpose because
28142840COMSPEC has a high degree of variability among users, leading to
2815portability concerns. Besides, Perl can use a shell that may not be
2841portability concerns. Besides, perl can use a shell that may not be
28162842fit for interactive use, and setting COMSPEC to such a shell may
28172843interfere with the proper functioning of other programs (which usually
28182844look in COMSPEC to find a shell fit for interactive use).
28192845
28202846=end original
28212847
28222848COMSPEC の値はユーザーによってかなり様々で、移植性の問題を引き起こすので、
28232849Perl はこの目的に COMSPEC は使わないことに注意してください。
28242850さらに、Perl は対話的な用途には向かないシェルも利用できますが、
28252851COMSPEC にそのようなシェルを指定すると他のプログラム
28262852(普通は対話的な用途に適したシェルを探すのに COMSPEC を使います)の適切な
28272853利用を邪魔するかもしれません。
28282854
28292855=begin original
28302856
28312857Before Perl 5.10.0 and 5.8.8, PERL5SHELL was not taint checked
28322858when running external commands. It is recommended that
28332859you explicitly set (or delete) C<$ENV{PERL5SHELL}> when running
28342860in taint mode under Windows.
28352861
28362862=end original
28372863
28382864Perl 5.10.0 と 5.8.8 以前では、PERL5SHELL は外部コマンドを実行するときに
28392865汚染チェックされませんでした。
28402866Windows 上で汚染モードで実行するときには、明示的に C<$ENV{PERL5SHELL}> を
28412867設定(または削除)することを勧めます。
28422868
28432869=item PERL_ALLOW_NON_IFS_LSP (specific to the Win32 port)
28442870X<PERL_ALLOW_NON_IFS_LSP>
28452871
28462872=begin original
28472873
2848Set to 1 to allow the use of non-IFS compatible LSPs (Layered Service Providers).
2874Set to 1 to allow the use of non-IFS compatible LSP's.
28492875Perl normally searches for an IFS-compatible LSP because this is required
28502876for its emulation of Windows sockets as real filehandles. However, this may
2851cause problems if you have a firewall such as I<McAfee Guardian>, which requires
2877cause problems if you have a firewall such as McAfee Guardian which requires
2852that all applications use its LSP but which is not IFS-compatible, because clearly
2878all applications to use its LSP which is not IFS-compatible, because clearly
28532879Perl will normally avoid using such an LSP.
2880Setting this environment variable to 1 means that Perl will simply use the
2881first suitable LSP enumerated in the catalog, which keeps McAfee Guardian
2882happy (and in that particular case Perl still works too because McAfee
2883Guardian's LSP actually plays some other games which allow applications
2884requiring IFS compatibility to work).
28542885
28552886=end original
28562887
28571 にセットすると、IFS 非互換の LSP (Layered Service Providers)
28881 にセットすると、IFS 非互換の LSP を使えるようにします。
2858使えるようにします。
28592889Perl は普通 IFS 互換の LSP を探します; Windows のソケットを本当の
28602890ファイルハンドルとしてエミュレートするために必要だからです。
28612891しかし、これは全てのアプリケーションが IFS 非互換の自身の LSP を使うことを
2862求める I<McAfee Guardian> のようなファイアウォールでは問題が起きます;
2892求める McAfee Guardian のようなファイアウォールでは問題が起きます;
28632893明らかに、Perl は普通そのような LSP を使うことを避けるからです。
2864
2865=begin original
2866
2867Setting this environment variable to 1 means that Perl will simply use the
2868first suitable LSP enumerated in the catalog, which keeps I<McAfee Guardian>
2869happy--and in that particular case Perl still works too because I<McAfee
2870Guardian>'s LSP actually plays other games which allow applications
2871requiring IFS compatibility to work.
2872
2873=end original
2874
28752894この環境変数を 1 にセットすることで、 Perl は単にカタログに挙げられている
2876もののうち最初の適切な LSP を使用し、これにより I<McAfee Guardian>
2895もののうち最初の適切な LSP を使用し、これにより McAfee Guardian は
2877幸せなままです--そしてこの特定の場合においては、I<McAfee Guardian> の LSP は
2896幸せなままです (そしてこの特定の場合においては、McAfee Guardian の LSP は
28782897実際には動作するために IFS 互換である必要があるアプリケーションのために
2879小細工をしているので、 Perl も正しく動きます。
2898小細工をしているので、 Perl も正しく動きます)
28802899
28812900=item PERL_DEBUG_MSTATS
28822901X<PERL_DEBUG_MSTATS>
28832902
28842903=begin original
28852904
2886Relevant only if Perl is compiled with the C<malloc> included with the Perl
2905Relevant only if perl is compiled with the malloc included with the perl
2887distribution; that is, if C<perl -V:d_mymalloc> is "define".
2906distribution (that is, if C<perl -V:d_mymalloc> is 'define').
2907If set, this causes memory statistics to be dumped after execution. If set
2889=end original
2908to an integer greater than one, also causes memory statistics to be dumped
2890
2891Perl が Perl 配布パッケージに含まれる malloc ルーチンを使って
2892コンパイルされている場合にのみ有効です; つまり C<perl -V:d_mymalloc> が
2893"define" の場合です。
2894
2895=begin original
2896
2897If set, this dumps out memory statistics after execution. If set
2898to an integer greater than one, also dumps out memory statistics
28992909after compilation.
29002910
29012911=end original
29022912
2913Perl が Perl 配布パッケージに含まれる malloc ルーチンを使って
2914コンパイルされている場合(C<perl -V:d_mymalloc> が 'define' の場合)にのみ
2915有効です。
29032916設定されると、実行後にメモリ状況が表示されます。
290429171 を超える数値が設定されると、コンパイル後にもメモリ状況を表示します。
29052918
29062919=item PERL_DESTRUCT_LEVEL
29072920X<PERL_DESTRUCT_LEVEL>
29082921
29092922=begin original
29102923
2911Controls the behaviour of global destruction of objects and other
2924Relevant only if your perl executable was built with B<-DDEBUGGING>,
2912references. See L<perlhacktips/PERL_DESTRUCT_LEVEL> for more information.
2925this controls the behavior of global destruction of objects and other
2926references. See L<perlhack/PERL_DESTRUCT_LEVEL> for more information.
29132927
29142928=end original
29152929
2916オブジェクトやそ他のリファレンスのグローバ
2930Perl 実行ファが B<-DDEBUGGING> 付きで構築された場合にのみ有効です。
2931このオプションはオブジェクトやその他のリファレンスのグローバルな
29172932デストラクタの振る舞いを制御します。
29182933さらなる情報については L<perlhack/PERL_DESTRUCT_LEVEL> を参照してください。
29192934
29202935=item PERL_DL_NONLAZY
29212936X<PERL_DL_NONLAZY>
29222937
29232938=begin original
29242939
2925Set to C<"1"> to have Perl resolve I<all> undefined symbols when it loads
2940Set to one to have perl resolve B<all> undefined symbols when it loads
29262941a dynamic library. The default behaviour is to resolve symbols when
29272942they are used. Setting this variable is useful during testing of
2928extensions, as it ensures that you get an error on misspelled function
2943extensions as it ensures that you get an error on misspelled function
2929names even if the test suite doesn't call them.
2944names even if the test suite doesn't call it.
29302945
29312946=end original
29322947
293329481 にセットすると、 Perl は B<全ての> 未定義シンボルをダイナミック
29342949ライブラリをロードしたときに解決します。
29352950デフォルトの振る舞いは使われるときにシンボルを解決します。
29362951この変数を設定することで、拡張機能のテスト時にたとえテストスイートが
29372952呼び出さなくても関数名のスペルミスによるエラーを確実に受け取ることが
29382953できるので便利です。
29392954
29402955=item PERL_ENCODING
29412956X<PERL_ENCODING>
29422957
29432958=begin original
29442959
2945If using the C<use encoding> pragma without an explicit encoding name, the
2960If using the C<encoding> pragma without an explicit encoding name, the
29462961PERL_ENCODING environment variable is consulted for an encoding name.
29472962
29482963=end original
29492964
2950C<use encoding> プラグマを明示的なエンコーディング名を指定せずに使用した場合、
2965C<encoding> プラグマを明示的なエンコーディング名を指定せずに使用した場合、
29512966PERL_ENCODING 環境変数がエンコーディング名として使われます。
29522967
29532968=item PERL_HASH_SEED
29542969X<PERL_HASH_SEED>
29552970
29562971=begin original
29572972
2958(Since Perl 5.8.1, new semantics in Perl 5.18.0) Used to override
2973(Since Perl 5.8.1.) Used to randomise perl's internal hash function.
2959the randomization of Perl's internal hash function. The value is expressed
2974To emulate the pre-5.8.1 behaviour, set to an integer (zero means
2960in hexadecimal, and may include a leading 0x. Truncated patterns
2975exactly the same order as 5.8.0). "Pre-5.8.1" means, among other
2961are treated as though they are suffixed with sufficient 0's as required.
2976things, that hash keys will always have the same ordering between
2977different runs of perl.
29622978
29632979=end original
29642980
2965(Perl 5.8.1 から; 新しい意味論は Perl 5.18.0 から)
2981(Perl 5.8.1 から) perl の内部ハッシュ関数のランダム化に使われます。
2966Perl内部ハッシュ関数のランダム化バーライドするために使います
29825.8.1 以前振る舞いエミュレするためには、整数を指定します
296716 進数で表現され、先頭の 0x含んでいてもかいません
2983(ゼロ5.8.0 と完全に同じ順序意味しす)
2968切りつめられたパターンは、必要な分の 0 が置されてるものとして扱われます。
2984"5.8.1 " とは、その他のこも含めて、Perl を何度実行して
2985ハッシュキーの並び順が常に同じであることを意味します。
29692986
29702987=begin original
29712988
2972If the option is provided, and C<PERL_PERTURB_KEYS> is NOT set, then
2989Most hashes return elements in the same order as Perl 5.8.0 by default.
2973a value of '0' implies C<PERL_PERTURB_KEYS=0>/C<PERL_PERTURB_KEYS=NO>
2990On a hash by hash basis, if pathological data is detected during a hash
2974and any other value implies
2991key insertion, then that hash will switch to an alternative random hash
2975C<PERL_PERTURB_KEYS=2>/C<PERL_PERTURB_KEYS=DETERMINISTIC>. See the
2992seed.
2976documentation for L<PERL_PERTURB_KEYS|/PERL_PERTURB_KEYS> for important
2977caveats regarding the C<DETERMINISTIC> mode.
29782993
29792994=end original
29802995
2981オプションが指定されて、C<PERL_PERTURB_KEYS> が設定されていない
2996Perl 5.8.0 ではデフォルトではほんどのハッシュは同じ順序で要素を返します。
2982値 '0' は
2997ハッシュからハッシュの単位で、ハッシュキー挿入中に異常なデータが検出されると、
2983C<PERL_PERTURB_KEYS=0>/C<PERL_PERTURB_KEYS=NO> として扱い、そ値は
2998ハッシュは代替ランダムハッシュ種に切り替えます。
2984C<PERL_PERTURB_KEYS=2>/C<PERL_PERTURB_KEYS=DETERMINISTIC> として扱います。
2985C<DETERMINISTIC> モードに関する重要な問題点については
2986L<PERL_PERTURB_KEYS|/PERL_PERTURB_KEYS> の文書を参照してください。
29872999
29883000=begin original
29893001
2990B<PLEASE NOTE: The hash seed is sensitive information>. Hashes are
3002The default behaviour is to randomise unless the PERL_HASH_SEED is set.
2991randomized to protect against local and remote attacks against Perl
3003If perl has been compiled with C<-DUSE_HASH_SEED_EXPLICIT>, the default
2992code. By manually setting a seed, this protection may be partially or
3004behaviour is B<not> to randomise unless the PERL_HASH_SEED is set.
2993completely lost.
29943005
29953006=end original
29963007
2997B<ハッシュ種は微妙な問題であことに注意してください>。
3008デフォルト舞いは、PERL_HASH_SEED がセットれな限り
2998ハッシュは Perl コードに対するローカル・リモート攻撃から守るために
29993009ランダム化されます。
3000手動種を設定することによりこの守りは部分的に、あるいは完全に失わます。
3010perl が C<-DUSE_HASH_SEED_EXPLICIT> 付きコンパイルさた場合、
3011デフォルトの振る舞いは PERL_HASH_SEED がセットされない限り
3012ランダム化 B<されません>。
30013013
30023014=begin original
30033015
3004See L<perlsec/"Algorithmic Complexity Attacks">, L</PERL_PERTURB_KEYS>, and
3016If PERL_HASH_SEED is unset or set to a non-numeric string, perl uses
3005L</PERL_HASH_SEED_DEBUG> for more information.
3017the pseudorandom seed supplied by the operating system and libraries.
30063018
30073019=end original
30083020
3009さらなる情報については L<perlsec/"Algorithmic Complexity Attacks">,
3021PERL_HASH_SEED がセットされないか、数値でない文字列がセットされた場合、
3010L</PERL_PERTURB_KEYS>, L</PERL_HASH_SEED_DEBUG> を参照してください。
3022Perl はオペレーティングシステムとライブラリが提供する擬似乱数の
3023種を使用します。
30113024
3012=item PERL_PERTURB_KEYS
3013X<PERL_PERTURB_KEYS>
3014
30153025=begin original
30163026
3017(Since Perl 5.18.0) Set to C<"0"> or C<"NO"> then traversing keys
3027B<Please note that the hash seed is sensitive information>. Hashes are
3018will be repeatable from run to run for the same C<PERL_HASH_SEED>.
3028randomized to protect against local and remote attacks against Perl
3019Insertion into a hash will not change the order, except to provide
3029code. By manually setting a seed this protection may be partially or
3020for more space in the hash. When combined with setting PERL_HASH_SEED
3030completely lost.
3021this mode is as close to pre 5.18 behavior as you can get.
30223031
30233032=end original
30243033
3025(Perl 5.18.0 から) C<"0"> また C<"NO"> を設定すると、同じ
3034B<ハッシュの種微妙な問題であに注意してください>。
3026C<PERL_HASH_SEED> でのキの探索順序は毎回同じなりま
3035ハッシュは Perl るローカル・リモート攻撃から守るために
3027ハッシュへの挿入は、ハッシュの容量が増える場合を除き、順序を変更しせん
3036ランダム化され
3028PERL_HASH_SEED を設定することと組み合わせると、可能な限り 5.18 より
3037手動で種を設定することより守りは部分的に、あるいは完全に失われます。
3029振る舞いに近づきます。
30303038
30313039=begin original
30323040
3033When set to C<"1"> or C<"RANDOM"> then traversing keys will be randomized.
3041See L<perlsec/"Algorithmic Complexity Attacks"> and
3034Every time a hash is inserted into the key order will change in a random
3042L</PERL_HASH_SEED_DEBUG> for more information.
3035fashion. The order may not be repeatable in a following program run
3036even if the PERL_HASH_SEED has been specified. This is the default
3037mode for perl when no PERL_HASH_SEED has been explicitly provided.
30383043
30393044=end original
30403045
3041C<"1"> またC<"RANDOM"> を設定する、キーの探索はランダム化されます。
3046さらなる情報についてL<perlsec/"Algorithmic Complexity Attacks"> と
3042ハッシュにキーが挿入れる毎に、順序はランダムに変わります
3047L</PERL_HASH_SEED_DEBUG> を参照してくだ
3043順序は、PERL_HASH_SEED が指定されていても、プログラムを再び実行したときに
3044再現できません。
3045これは、PERL_HASH_SEED が明示的に設定されていない場合は、
3046perl のデフォルトのモードです。
30473048
3048=begin original
3049
3050When set to C<"2"> or C<"DETERMINISTIC"> then inserting keys into a hash
3051will cause the key order to change, but in a way that is repeatable from
3052program run to program run, provided that the same hash seed is used,
3053and that the code does not itself perform any non-deterministic
3054operations and also provided exactly the same environment context.
3055Adding or removing an environment variable may and likely will change
3056the key order. If any part of the code builds a hash using non-
3057deterministic keys, for instance a hash keyed by the stringified form of
3058a reference, or the address of the objects it contains, then this may
3059and likely will have a global effect on the key order of *every* hash in
3060the process. To work properly this setting MUST be coupled with the
3061L<PERL_HASH_SEED|/"PERL_HASH_SEED"> to produce deterministic results,
3062and in fact, if you do set the C<PERL_HASH_SEED> explicitly you do not
3063need to set this as well, it will be automatically set to this mode.
3064
3065=end original
3066
3067C<"2"> または C<"DETERMINISTIC"> に設定すると、ハッシュへのキーの挿入によって
3068キーの順序が変わりますが、同じハッシュキーが使われ、
3069コード自体が非決定的な操作をせず、正確に同じ環境コンテキストを
3070提供すれば、プログラムを再び実行したときには再現可能です。
3071環境変数を追加または削除すると、おそらくキーの順序が変わりますう。
3072コードのどこかが非決定的なキーを使ったハッシュ、
3073例えばリファレンスの文字列化形式や、それを含むオブジェクトのアドレスを
3074キーにしたハッシュを構築すると、これはおそらくプロセス中の
3075「全ての」ハッシュのキーの順序にグローバルな影響を与えます。
3076これが正しく動作するには、決定的な結果を生成するために
3077L<PERL_HASH_SEED|/"PERL_HASH_SEED"> と共に使われなければならず、
3078実際の所、C<PERL_HASH_SEED> を明示的に設定した場合、
3079これも設定する必要はありません; 自動的にこのモードに設定されます。
3080
3081=begin original
3082
3083B<NOTE:> Use of this option is considered insecure, and is intended only
3084for debugging non-deterministic behavior in Perl's hash function. Do
3085not use it in production.
3086
3087=end original
3088
3089B<注意:> このオプションはセキュアではないと考えられていて、Perl のハッシュ関数の
3090非決定的な振る舞いのデバッグ専用であることを意図しています。
3091製品で使わないでください。
3092
3093=begin original
3094
3095See L<perlsec/"Algorithmic Complexity Attacks"> and L</PERL_HASH_SEED>
3096and L</PERL_HASH_SEED_DEBUG> for more information. You can get and set the
3097key traversal mask for a specific hash by using the C<hash_traversal_mask()>
3098function from L<Hash::Util>.
3099
3100=end original
3101
3102さらなる情報については L<perlsec/"Algorithmic Complexity Attacks">,
3103L</PERL_HASH_SEED>, L</PERL_HASH_SEED_DEBUG> を参照してください。
3104L<Hash::Util> にある C<hash_traversal_mask()> を使うことで、特定のハッシュに
3105対するキー探索マスクを取得および設定できます。
3106
31073049=item PERL_HASH_SEED_DEBUG
31083050X<PERL_HASH_SEED_DEBUG>
31093051
31103052=begin original
31113053
3112(Since Perl 5.8.1.) Set to C<"1"> to display (to STDERR) information
3054(Since Perl 5.8.1.) Set to one to display (to STDERR) the value of
3113about the hash function, seed, and what type of key traversal
3055the hash seed at the beginning of execution. This, combined with
3114randomization is in effect at the beginning of execution. This, combined
3056L</PERL_HASH_SEED> is intended to aid in debugging nondeterministic
3115with L</PERL_HASH_SEED> and L</PERL_PERTURB_KEYS> is intended to aid in
3057behavior caused by hash randomization.
3116debugging nondeterministic behaviour caused by hash randomization.
31173058
31183059=end original
31193060
3120(Perl 5.8.1 から)
3061(Perl 5.8.1 から) これを 1 に設定すると、実行開始時にハッシュの種の
3121これ C<"1"> 設定ると、実行開始時にハッシュ関数、種、どの種類のキー横断
3062画面(STDERR)出力しま
3122ランダム化が有効か関する情報を画面(STDERR)に出力します。
3063これは L</PERL_HASH_SEED> と組み合わせることでハッシュのランダム化に
3123これは L</PERL_HASH_SEED> おび L</PERL_PERTURB_KEYS> と組み合わせること
3064よる非決定的な振る舞いのデバッグを助けることを目的としています。
3124ハッシュのランダム化による非決定的な振る舞いのデバッグを助けることを
3125目的としています。
31263065
31273066=begin original
31283067
3129B<Note> that any information about the hash function, especially the hash
3068B<Note that the hash seed is sensitive information>: by knowing it one
3130seed is B<sensitive information>: by knowing it, one can craft a denial-of-service
3069can craft a denial-of-service attack against Perl code, even remotely,
3131attack against Perl code, even remotely; see L<perlsec/"Algorithmic Complexity Attacks">
3070see L<perlsec/"Algorithmic Complexity Attacks"> for more information.
3132for more information. B<Do not disclose the hash seed> to people who
3071B<Do not disclose the hash seed> to people who don't need to know it.
3133don't need to know it. See also L<C<hash_seed()>|Hash::Util/hash_seed> and
3072See also hash_seed() of L<Hash::Util>.
3134L<C<hash_traversal_mask()>|Hash::Util/hash_traversal_mask>.
31353073
31363074=end original
31373075
3138ハッシュ関数に関する情報、特にハッシュの種は B<微妙な問題> であることに
3076B<ハッシュの種は微妙な問題であることに注意してください>:
3139B<注意してください>: これを知ることで、リモートからでも Perl のコードに対して
3077これを知ることで、リモートからでも Perl のコードに対してサービス拒否攻撃を
3140サービス拒否攻撃を仕掛けることが出来ます; さらなる情報については
3078仕掛けることが出来ます
3141L<perlsec/"Algorithmic Complexity Attacks"> を参照してください。
3079さらなる情報については L<perlsec/"Algorithmic Complexity Attacks"> を
3142知る必要のない人々に対して B<ハッシュの種を公開しないでください>。
3143L<C<hash_seed()>|Hash::Util/hash_seed> と
3144L<C<hash_traversal_mask()>|Hash::Util/hash_traversal_mask> も
31453080参照してください。
3081知る必要のない人々に対して B<ハッシュの種を公開しないでください>。
3082L<Hash::Util> の hash_seed() も参照してください。
31463083
3147=begin original
3148
3149An example output might be:
3150
3151=end original
3152
3153出力の例は以下のようなものです:
3154
3155 HASH_FUNCTION = ONE_AT_A_TIME_HARD HASH_SEED = 0x652e9b9349a7a032 PERTURB_KEYS = 1 (RANDOM)
3156
3157=item PERL_MEM_LOG
3158X<PERL_MEM_LOG>
3159
3160=begin original
3161
3162If your Perl was configured with B<-Accflags=-DPERL_MEM_LOG>, setting
3163the environment variable C<PERL_MEM_LOG> enables logging debug
3164messages. The value has the form C<< <I<number>>[m][s][t] >>, where
3165C<I<number>> is the file descriptor number you want to write to (2 is
3166default), and the combination of letters specifies that you want
3167information about (m)emory and/or (s)v, optionally with
3168(t)imestamps. For example, C<PERL_MEM_LOG=1mst> logs all
3169information to stdout. You can write to other opened file descriptors
3170in a variety of ways:
3171
3172=end original
3173
3174Perl が B<-Accflags=-DPERL_MEM_LOG> で設定されていると、環境変数
3175C<PERL_MEM_LOG> を設定することでデバッグメッセージのログ出力を有効にします。
3176値は C<< <I<number>>[m][s][t] >> の形式で、C<I<number>> は書き込みたい
3177ファイル記述子番号 (デフォルトは 2)、文字の組み合わせはメモリ (m) と SV(s) で、
3178オプションとしてタイプスタンプ (t) です。
3179例えば、C<PERL_MEM_LOG=1mst> は全てのログ情報を標準出力に出力します。
3180応用として、開いている他のファイル記述子に書き込むこともできます:
3181
3182 $ 3>foo3 PERL_MEM_LOG=3m perl ...
3183
31843084=item PERL_ROOT (specific to the VMS port)
31853085X<PERL_ROOT>
31863086
31873087=begin original
31883088
3189A translation-concealed rooted logical name that contains Perl and the
3089A translation concealed rooted logical name that contains perl and the
31903090logical device for the @INC path on VMS only. Other logical names that
3191affect Perl on VMS include PERLSHR, PERL_ENV_TABLES, and
3091affect perl on VMS include PERLSHR, PERL_ENV_TABLES, and
3192SYS$TIMEZONE_DIFFERENTIAL, but are optional and discussed further in
3092SYS$TIMEZONE_DIFFERENTIAL but are optional and discussed further in
31933093L<perlvms> and in F<README.vms> in the Perl source distribution.
31943094
31953095=end original
31963096
31973097Perl と VMS 専用の @INC のための論理デバイスを含む、
31983098変換が隠されたルートとなる論理名です。
31993099VMS の Perl に影響を与えるその他の論理名としては PERLSHR, PERL_ENV_TABLES,
3200SYS$TIMEZONE_DIFFERENTIAL がありますが、これらはオプションです;
3100SYS$TIMEZONE_DIFFERENTIAL がありますが、これらはオプションです
32013101詳細については Perl ソース配布パッケージの L<perlvms> と F<README.vms> で
32023102議論されています。
32033103
32043104=item PERL_SIGNALS
32053105X<PERL_SIGNALS>
32063106
32073107=begin original
32083108
3209Available in Perls 5.8.1 and later. If set to C<"unsafe">, the pre-Perl-5.8.0
3109In Perls 5.8.1 and later. If set to C<unsafe> the pre-Perl-5.8.0
3210signal behaviour (which is immediate but unsafe) is restored. If set
3110signals behaviour (immediate but unsafe) is restored. If set to
3211to C<safe>, then safe (but deferred) signals are used. See
3111C<safe> the safe (or deferred) signals are used.
3212L<perlipc/"Deferred Signals (Safe Signals)">.
3112See L<perlipc/"Deferred Signals (Safe Signals)">.
32133113
32143114=end original
32153115
32163116Perl 5.8.1 以降で有効です。
32173117これに C<unsafe> をセットすると、Perl 5.8.0 以前のシグナルの振る舞い
32183118(直接的ですが安全ではありません)が復元されます。
3219C<safe> をセットすると安全な(しかし遅延する)シグナルが使われます。
3119C<safe>をセットすると安全な(遅延する)シグナルが使われます。
32203120L<perlipc/"Deferred Signals (Safe Signals)"> を参照してください。
32213121
32223122=item PERL_UNICODE
32233123X<PERL_UNICODE>
32243124
32253125=begin original
32263126
3227Equivalent to the L<-C|/-C [numberE<sol>list]> command-line switch. Note
3127Equivalent to the B<-C> command-line switch. Note that this is not
3228that this is not a boolean variable. Setting this to C<"1"> is not the
3128a boolean variable-- setting this to C<"1"> is not the right way to
3229right way to "enable Unicode" (whatever that would mean). You can use
3129"enable Unicode" (whatever that would mean). You can use C<"0"> to
3230C<"0"> to "disable Unicode", though (or alternatively unset PERL_UNICODE
3130"disable Unicode", though (or alternatively unset PERL_UNICODE in
3231in your shell before starting Perl). See the description of the
3131your shell before starting Perl). See the description of the C<-C>
3232L<-C|/-C [numberE<sol>list]> switch for more information.
3132switch for more information.
32333133
32343134=end original
32353135
3236L<-C|/-C [numberE<sol>list]> コマンドラインスイッチと等価です。
3136B<-C> コマンドラインスイッチと等価です。
3237これは真偽値変数ではないことに注意してください
3137これは真偽値変数ではないことに注意してください -- これを C<"1"> に
3238これを C<"1"> にセットすることは(どんな意味においても)Unicode を
3138セットすることは(どんな意味においても)"Unicode を有効にする"ための
3239有効にする」ための正しい方法ではありません。
3139正しい方法ではありません。
3240しかし、Unicode を無効にするために C<"0"> をセットすることは出来ます
3140しかし、"Unicode を無効にする"ために C<"0"> をセットすることは出来ます
32413141(あるいは Perl の起動前にあなたのお使いのシェルで PERL_UNICODE を
32423142未設定にすることでも出来ます)。
3243さらなる情報については L<-C|/-C [numberE<sol>list]> スイッチの説明を
3143さらなる情報については C<-C> スイッチの説明を参照してください。
3244参照してください。
32453144
3246=item PERL_USE_UNSAFE_INC
3247X<PERL_USE_UNSAFE_INC>
3248
3249=begin original
3250
3251If perl has been configured to not have the current directory in
3252L<C<@INC>|perlvar/@INC> by default, this variable can be set to C<"1">
3253to reinstate it. It's primarily intended for use while building and
3254testing modules that have not been updated to deal with "." not being in
3255C<@INC> and should not be set in the environment for day-to-day use.
3256
3257=end original
3258
3259perl がデフォルトで L<C<@INC>|perlvar/@INC> にカレントディレクトリを
3260含まないように設定されている場合、
3261これを再設定するためにこの変数を C<"1"> にできます。
3262これは、C<@INC> に "." がなくても動作するように更新されていないモジュールの
3263ビルドとテストのために使うことを第一の目的としているので、
3264日常使用環境では設定するべきではありません。
3265
32663145=item SYS$LOGIN (specific to the VMS port)
32673146X<SYS$LOGIN>
32683147
32693148=begin original
32703149
3271Used if chdir has no argument and L</HOME> and L</LOGDIR> are not set.
3150Used if chdir has no argument and HOME and LOGDIR are not set.
32723151
32733152=end original
32743153
3275chdir の引数がなく、L</HOME>
3154chdir の引数がなく、HOME と LOGDIR がセットされていないときに使われます。
3276L</LOGDIR> がセットされていないときに使われます。
32773155
3278=item PERL_INTERNAL_RAND_SEED
3279X<PERL_INTERNAL_RAND_SEED>
3280
3281=begin original
3282
3283Set to a non-negative integer to seed the random number generator used
3284internally by perl for a variety of purposes.
3285
3286=end original
3287
3288様々な目的のために、perl によって内部で使われる乱数生成器の種となる
3289非負整数を設定します。
3290
3291=begin original
3292
3293Ignored if perl is run setuid or setgid. Used only for some limited
3294startup randomization (hash keys) if C<-T> or C<-t> perl is started
3295with tainting enabled.
3296
3297=end original
3298
3299perl が setuid または setgid で実行されている場合は無視されます。
3300C<-T> や C<-t> perl が汚染モードを有効にして開始された場合、
3301一部の制限されたランダム化の設定(ハッシュキー)のみに使われます。
3302
3303=begin original
3304
3305Perl may be built to ignore this variable.
3306
3307=end original
3308
3309Perl はこの変数を無視するようにビルドされているかもしれません。
3310
3311=item PERL_RAND_SEED
3312X<PERL_RAND_SEED>
3313
3314=begin original
3315
3316When set to an integer value this value will be used to seed the perl
3317internal random number generator used for C<rand()> when it is used
3318without an explicit C<srand()> call or for when an explicit no-argument
3319C<srand()> call is made.
3320
3321=end original
3322
3323整数が設定されると、この値は、
3324明示的な C<srand()> 呼び出しがなかったり、引数なしでの明示的な
3325C<srand()> 呼び出しが行われたとき、
3326C<rand()> のための perl 内部の乱数生成器の種として使われます。
3327
3328=begin original
3329
3330Normally calling C<rand()> prior to calling C<srand()> or calling
3331C<srand()> explicitly with no arguments should result in the random
3332number generator using "best efforts" to seed the generator state with a
3333relatively high quality random seed. When this environment variable is
3334set then the seeds used will be deterministically computed from the
3335value provided in the env var in such a way that the application process
3336and any forks or threads should continue to have their own unique seed but
3337that the program may be run twice with identical results as far as
3338C<rand()> goes (assuming all else is equal).
3339
3340=end original
3341
3342通常、C<srand()> の前に C<rand()> を呼び出したり、引数なしで明示的に
3343C<srand()> を呼び出した場合、
3344比較的高品質な乱数の種によって生成器の状態に
3345種を設定するために、乱数生成器は「ベストエフォート」を行います。
3346この環境変数が設定されると、使われる種は、
3347アプリケーションプロセスとそのフォークやスレッドがそれぞれ固有の
3348ユニークな種を持ち続けれるけれども、
3349プログラムが 2 回実行されても、C<rand()> に関しては (他の全てが同じなら)
3350同じ結果になるような方法で、決定論的に計算されます。
3351
3352=begin original
3353
3354PERL_RAND_SEED is intended for performance measurements and debugging
3355and is explicitly NOT intended for stable testing. The only guarantee is
3356that a specific perl executable will produce the same results twice in a
3357row, there is no guarantee that the results will be the same between
3358perl releases or on different architectures.
3359
3360=end original
3361
3362PERL_RAND_SEED は性能計測とデバッグを意図したもので、
3363安定したテストを意図したものでは明示的に異なります。
3364保証されることは、特定の perl バイナリが 2 回同じ結果を
3365出力することだけであり、
3366perl リリースが異なったりアーキテクチャがことなったりしたときの
3367結果は保証しません。
3368
3369=begin original
3370
3371Ignored if perl is run setuid or setgid.
3372
3373=end original
3374
3375perl が setuid または setgid で実行されると、これは無視されます。
3376
33773156=back
33783157
33793158=begin original
33803159
33813160Perl also has environment variables that control how Perl handles data
3382specific to particular natural languages; see L<perllocale>.
3161specific to particular natural languages. See L<perllocale>.
33833162
33843163=end original
33853164
33863165特定の自然言語に特有のデータを Perl がどのように扱うかを制御する
3387環境変数もあります; L<perllocale> を参照してください
3166環境変数もあります。
3167L<perllocale> を参照して下さい。
33883168
33893169=begin original
33903170
3391Perl and its various modules and components, including its test frameworks,
3171Apart from these, Perl uses no other environment variables, except
3392may sometimes make use of certain other environment variables. Some of
3172to make them available to the program being executed, and to child
3393these are specific to a particular platform. Please consult the
3173processes. However, programs running setuid would do well to execute
3394appropriate module documentation and any documentation for your platform
3174the following lines before doing anything else, just to keep people
3395(like L<perlsolaris>, L<perllinux>, L<perlmacosx>, L<perlwin32>, etc) for
3175honest:
3396variables peculiar to those specific situations.
33973176
33983177=end original
33993178
3400Perl および様々なモジュールとテストフレーワークを含む構成要素
3179これらの他には実行されているプログラあるい子プロセスがが有効に
3401ときどきその他の特定の環境変数を使うかもしれません。
3180しない限り、Perl は環境変数を使ません。
3402その一部は特定のプラットフォームに固有です。
3403そのような特定の状況に特有の変数については適切なモジュールの文書と
3404(L<perlsolaris>, L<perllinux>, L<perlmacosx>, L<perlwin32> などのような)
3405プラットフォームの文書を参照してください。
3406
3407=begin original
3408
3409Perl makes all environment variables available to the program being
3410executed, and passes these along to any child processes it starts.
3411However, programs running setuid would do well to execute the following
3412lines before doing anything else, just to keep people honest:
3413
3414=end original
3415
3416Perl は、実行されたプログラムへの全ての環境変数を利用可能にし、
3417子プロセスが開始されたときにはそれらを渡します。
34183181しかし、setuid で動作するプログラムは何かをする前に、単に人々に変な気を
34193182起こさせないために以下のコードを入れておくのがよいです。
34203183
3421 $ENV{PATH} = "/bin:/usr/bin"; # or whatever you need
3184 $ENV{PATH} = '/bin:/usr/bin'; # or whatever you need
3422 $ENV{SHELL} = "/bin/sh" if exists $ENV{SHELL};
3185 $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
34233186 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
3424
3425=head1 ORDER OF APPLICATION
3426
3427(適用の順序)
3428
3429=begin original
3430
3431Some options, in particular C<-I>, C<-M>, C<PERL5LIB> and C<PERL5OPT> can
3432interact, and the order in which they are applied is important.
3433
3434=end original
3435
3436一部のオプション、特に C<-M>, C<PERL5LIB>, C<PERL5OPT> は相互作用するので、
3437これらが適用される順序は重要です。
3438
3439=begin original
3440
3441Note that this section does not document what I<actually> happens inside the
3442perl interpreter, it documents what I<effectively> happens.
3443
3444=end original
3445
3446この節は、perl インタプリタの中で I<実際に> 何が起きるかを
3447記述しているのではなく、I<事実上> 何が起きるかを記述していることに
3448注意してください。
3449
3450=over
3451
3452=item -I
3453
3454=begin original
3455
3456The effect of multiple C<-I> options is to C<unshift> them onto C<@INC>
3457from right to left. So for example:
3458
3459=end original
3460
3461複数 C<-I> オプションを指定した効果は、
3462これらを右から左に C<@INC> に C<unshift> します。
3463それで、例えば:
3464
3465 perl -I 1 -I 2 -I 3
3466
3467=begin original
3468
3469will first prepend C<3> onto the front of C<@INC>, then prepend C<2>, and
3470then prepend C<1>. The result is that C<@INC> begins with:
3471
3472=end original
3473
3474はまず C<@INC> の先頭に C<3> を追加し、それから C<2> を追加し、
3475それから C<1> を追加します。
3476結果として、C<@INC> は次で始まります:
3477
3478 qw(1 2 3)
3479
3480=item -M
3481
3482=begin original
3483
3484Multiple C<-M> options are processed from left to right. So this:
3485
3486=end original
3487
3488複数の C<-M> オプションは、左から右に処理されます。
3489それで、これは:
3490
3491 perl -Mlib=1 -Mlib=2 -Mlib=3
3492
3493=begin original
3494
3495will first use the L<lib> pragma to prepend C<1> to C<@INC>, then
3496it will prepend C<2>, then it will prepend C<3>, resulting in an C<@INC>
3497that begins with:
3498
3499=end original
3500
3501まず C<@INC> の先頭に C<1> を追加するために L<lib> プラグマが使われ、
3502それから C<2> を追加し、それから C<3> 追加して、結果として C<@INC> は
3503次のもので始まります:
3504
3505 qw(3 2 1)
3506
3507=item the PERL5LIB environment variable
3508
3509=begin original
3510
3511This contains a list of directories, separated by colons. The entire list
3512is prepended to C<@INC> in one go. This:
3513
3514=end original
3515
3516これはコロンで区切られたディレクトリのリストを含みます。
3517リスト全体は一度に C<@INC> の先頭に追加されます。
3518これは:
3519
3520 PERL5LIB=1:2:3 perl
3521
3522=begin original
3523
3524will result in an C<@INC> that begins with:
3525
3526=end original
3527
3528C<@INC> が次のもので始まる結果となります:
3529
3530 qw(1 2 3)
3531
3532=item combinations of -I, -M and PERL5LIB
3533
3534(-I, -M, PERL5LIB の組み合わせ)
3535
3536=begin original
3537
3538C<PERL5LIB> is applied first, then all the C<-I> arguments, then all the
3539C<-M> arguments. This:
3540
3541=end original
3542
3543C<PERL5LIB> は最初に適用され、それから全ての C<-I> 引数、それから全ての
3544C<-M> 引数です。
3545これは:
3546
3547 PERL5LIB=e1:e2 perl -I i1 -Mlib=m1 -I i2 -Mlib=m2
3548
3549=begin original
3550
3551will result in an C<@INC> that begins with:
3552
3553=end original
3554
3555C<@INC> が次のもので始まる結果となります:
3556
3557 qw(m2 m1 i1 i2 e1 e2)
3558
3559=item the PERL5OPT environment variable
3560
3561=begin original
3562
3563This contains a space separated list of switches. We only consider the
3564effects of C<-M> and C<-I> in this section.
3565
3566=end original
3567
3568これはスペースで区切られたオプションのリストです。
3569この節では C<-M> と C<-I> の効果だけを考慮します。
3570
3571=begin original
3572
3573After normal processing of C<-I> switches from the command line, all
3574the C<-I> switches in C<PERL5OPT> are extracted. They are processed from
3575left to right instead of from right to left. Also note that while
3576whitespace is allowed between a C<-I> and its directory on the command
3577line, it is not allowed in C<PERL5OPT>.
3578
3579=end original
3580
3581コマンドラインからの C<-I> オプションの通常の処理の後、
3582C<PERL5OPT> の全ての C<-I> オプションが展開されます。
3583これらは右から左ではなく、左から右に処理されます。
3584また、コマンドラインでは C<-I とディレクトリの間に空白が許されますが、
3585C<PERL5OPT> では許されないことにも注意してください。
3586
3587=begin original
3588
3589After normal processing of C<-M> switches from the command line, all
3590the C<-M> switches in C<PERL5OPT> are extracted. They are processed from
3591left to right, I<i.e.> the same as those on the command line.
3592
3593=end original
3594
3595コマンドラインからの C<-M> オプションの通常の処理の後、
3596C<PERL5OPT> の全ての C<-M> オプションが展開されました。
3597これらは左から右に処理されます; I<つまり> コマンドラインと同じです。
3598
3599=begin original
3600
3601An example may make this clearer:
3602
3603=end original
3604
3605この例でよりはっきりするでしょう:
3606
3607 export PERL5OPT="-Mlib=optm1 -Iopti1 -Mlib=optm2 -Iopti2"
3608 export PERL5LIB=e1:e2
3609 perl -I i1 -Mlib=m1 -I i2 -Mlib=m2
3610
3611=begin original
3612
3613will result in an C<@INC> that begins with:
3614
3615=end original
3616
3617C<@INC> が次のもので始まる結果となります:
3618
3619 qw(
3620 optm2
3621 optm1
3622
3623 m2
3624 m1
3625
3626 opti2
3627 opti1
3628
3629 i1
3630 i2
3631
3632 e1
3633 e2
3634 )
3635
3636=item Other complications
3637
3638(その他の複雑なもの)
3639
3640=begin original
3641
3642There are some complications that are ignored in the examples above:
3643
3644=end original
3645
3646前述の例で無視されている複雑なものがいくつかあります:
3647
3648=over
3649
3650=item arch and version subdirs
3651
3652(arch と version subdirs)
3653
3654=begin original
3655
3656All of C<-I>, C<PERL5LIB> and C<use lib> will also prepend arch and version
3657subdirs if they are present
3658
3659=end original
3660
3661C<-I>, C<PERL5LIB>, C<use lib> の全ては、
3662(存在すれば) arch と version サブディレクトリが前置されます。
3663
3664=item sitecustomize.pl
3665
3666=back
3667
3668=back
36693187
36703188=begin meta
36713189
36723190Translate: 吉村 寿人 <JAE00534@niftyserve.or.jp>
36733191Update: SHIRAKATA Kentaro <argrath@ub32.org>
36743192Status: completed
36753193
36763194=end meta