perlrun >
5.40.0
との差分
perlrun 5.40.0 と 5.10.1 の差分
1 | 1 | |
2 | =encoding u | |
2 | =encoding euc-jp | |
3 | 3 | |
4 | 4 | =head1 NAME |
5 | 5 | |
6 | 6 | =begin original |
7 | 7 | |
8 | 8 | perlrun - how to execute the Perl interpreter |
9 | 9 | |
10 | 10 | =end original |
11 | 11 | |
12 | 12 | perlrun - Perl インタプリタの起動方法 |
13 | 13 | |
14 | 14 | =head1 SYNOPSIS |
15 | 15 | |
16 | B<perl> S<[ B<- | |
16 | B<perl> S<[ B<-sTtuUWX> ]> | |
17 | S<[ B<-h | |
17 | S<[ B<-hv> ] [ B<-V>[:I<configvar>] ]> | |
18 | 18 | S<[ B<-cw> ] [ B<-d>[B<t>][:I<debugger>] ] [ B<-D>[I<number/list>] ]> |
19 | 19 | S<[ B<-pna> ] [ B<-F>I<pattern> ] [ B<-l>[I<octal>] ] [ B<-0>[I<octal/hexadecimal>] ]> |
20 | 20 | S<[ B<-I>I<dir> ] [ B<-m>[B<->]I<module> ] [ B<-M>[B<->]I<'module...'> ] [ B<-f> ]> |
21 | 21 | S<[ B<-C [I<number/list>] >]> |
22 | S<[ B<-P> ]> | |
22 | 23 | S<[ B<-S> ]> |
23 | 24 | S<[ B<-x>[I<dir>] ]> |
24 | 25 | S<[ B<-i>[I<extension>] ]> |
25 | 26 | S<[ [B<-e>|B<-E>] I<'command'> ] [ B<--> ] [ I<programfile> ] [ I<argument> ]...> |
26 | 27 | |
27 | 28 | =head1 DESCRIPTION |
28 | 29 | |
29 | 30 | =begin original |
30 | 31 | |
31 | 32 | The normal way to run a Perl program is by making it directly |
32 | 33 | executable, or else by passing the name of the source file as an |
33 | 34 | argument on the command line. (An interactive Perl environment |
34 | 35 | is also possible--see L<perldebug> for details on how to do that.) |
35 | 36 | Upon startup, Perl looks for your program in one of the following |
36 | 37 | places: |
37 | 38 | |
38 | 39 | =end original |
39 | 40 | |
40 | 41 | Perl プログラムを実行する普通の方法は、直接実行できる形にするか、 |
41 | 42 | コマンドラインの引数としてソースファイルの名前を渡すことです。 |
42 | 43 | (対話的な Perl 環境もあります -- どのようにするかの詳細については |
43 | L<perldebug> を参照して | |
44 | L<perldebug> を参照して下さい。) | |
44 | 45 | 実行にあたって、Perl は指定されたプログラムを以下に示す場所で |
45 | 46 | 探します: |
46 | 47 | |
47 | 48 | =over 4 |
48 | 49 | |
49 | 50 | =item 1. |
50 | 51 | |
51 | 52 | =begin original |
52 | 53 | |
53 | Specified line by line via | |
54 | Specified line by line via B<-e> or B<-E> switches on the command line. | |
54 | switches on the command line. | |
55 | 55 | |
56 | 56 | =end original |
57 | 57 | |
58 | コマンドライン上で | |
58 | コマンドライン上で B<-e> か B<-E> のスイッチで指定された行。 | |
59 | L<-E|/-E commandline> のスイッチで指定された行。 | |
60 | 59 | |
61 | 60 | =item 2. |
62 | 61 | |
63 | 62 | =begin original |
64 | 63 | |
65 | 64 | Contained in the file specified by the first filename on the command line. |
66 | (Note that systems supporting the | |
65 | (Note that systems supporting the #! notation invoke interpreters this | |
67 | way. See L< | |
66 | way. See L<Location of Perl>.) | |
68 | 67 | |
69 | 68 | =end original |
70 | 69 | |
71 | 70 | コマンドライン上で最初のファイル名として示されたファイルの中。 |
72 | ( | |
71 | (#! 記法をサポートしているシステムでは、このようにして | |
73 | 72 | インタプリタを呼び出します。 |
74 | L< | |
73 | L<Location of Perl> を参照して下さい。) | |
75 | 74 | |
76 | 75 | =item 3. |
77 | 76 | |
78 | 77 | =begin original |
79 | 78 | |
80 | 79 | Passed in implicitly via standard input. This works only if there are |
81 | 80 | no filename arguments--to pass arguments to a STDIN-read program you |
82 | 81 | must explicitly specify a "-" for the program name. |
83 | 82 | |
84 | 83 | =end original |
85 | 84 | |
86 | 85 | 標準入力から暗黙に渡される。 |
87 | ファイル名を示す引数が無い場合にのみうまくいきます | |
86 | ファイル名を示す引数が無い場合にのみうまくいきます。 | |
88 | プログラムに引数を渡すには、 | |
87 | STDIN から読み込むプログラムに引数を渡すには、 | |
89 | 指定しなくてはなりません、 | |
88 | プログラム名として明示的に "-" を指定しなくてはなりません、 | |
90 | 89 | |
91 | 90 | =back |
92 | 91 | |
93 | 92 | =begin original |
94 | 93 | |
95 | 94 | With methods 2 and 3, Perl starts parsing the input file from the |
96 | beginning, unless you've specified a | |
95 | beginning, unless you've specified a B<-x> switch, in which case it | |
97 | scans for the first line starting with | |
96 | scans for the first line starting with #! and containing the word | |
98 | 97 | "perl", and starts there instead. This is useful for running a program |
99 | 98 | embedded in a larger message. (In this case you would indicate the end |
100 | 99 | of the program using the C<__END__> token.) |
101 | 100 | |
102 | 101 | =end original |
103 | 102 | |
104 | 2 番目、3 番目の方法では、 | |
103 | 2 番目、3 番目の方法では、B<-x> スイッチを指定した場合を除いて、 | |
105 | Perl は入力ファイルを最初から解析し始めます | |
104 | Perl は入力ファイルを最初から解析し始めます。 | |
106 | ||
105 | B<-x> スイッチを | |
107 | ||
106 | 指定した場合には、まず、最初に #! と "perl" という文字列を | |
107 | 含む行を探し、そこから解析を始めます。 | |
108 | 108 | これは、大きなテキストにプログラムを埋め込んで、実行するようなときに便利です。 |
109 | 109 | (この場合、プログラムの終わりは、トークン C<__END__> を使って |
110 | 110 | 示すとよいでしょう。) |
111 | 111 | |
112 | 112 | =begin original |
113 | 113 | |
114 | The | |
114 | The #! line is always examined for switches as the line is being | |
115 | 115 | parsed. Thus, if you're on a machine that allows only one argument |
116 | with the | |
116 | with the #! line, or worse, doesn't even recognize the #! line, you | |
117 | still can get consistent switch behavio | |
117 | still can get consistent switch behavior regardless of how Perl was | |
118 | invoked, even if | |
118 | invoked, even if B<-x> was used to find the beginning of the program. | |
119 | 119 | |
120 | 120 | =end original |
121 | 121 | |
122 | ||
122 | #! を含む行のスイッチが必ず解析されるようになりました。 | |
123 | つまり、 | |
123 | つまり、#! の行で引数が一つしか許されない、あるいはもっと悪く、 | |
124 | ||
124 | #! の行が認識されないといったシステムで運用している場合にも、B<-x> で | |
125 | ||
125 | プログラムの開始位置を見つけた場合を含め、どのように Perl が起動されたかに | |
126 | ||
126 | よらず、一貫したスイッチの動作を期待できるようになっています。 | |
127 | 127 | |
128 | 128 | =begin original |
129 | 129 | |
130 | 130 | Because historically some operating systems silently chopped off |
131 | kernel interpretation of the | |
131 | kernel interpretation of the #! line after 32 characters, some | |
132 | 132 | switches may be passed in on the command line, and some may not; |
133 | 133 | you could even get a "-" without its letter, if you're not careful. |
134 | 134 | You probably want to make sure that all your switches fall either |
135 | 135 | before or after that 32-character boundary. Most switches don't |
136 | 136 | actually care if they're processed redundantly, but getting a "-" |
137 | 137 | instead of a complete switch could cause Perl to try to execute |
138 | standard input instead of your program. And a partial | |
138 | standard input instead of your program. And a partial B<-I> switch | |
139 | ||
139 | could also cause odd results. | |
140 | 140 | |
141 | 141 | =end original |
142 | 142 | |
143 | 歴史的なオペレーティングシステムの中にはカーネルによる | |
143 | 歴史的なオペレーティングシステムの中にはカーネルによる #! 行の解釈が、 | |
144 | 144 | エラーなしに 32 文字で打ち切られてしまうものがありますので、あるスイッチは |
145 | コマンドラインに渡され、あるスイッチは渡されないといったことが起こります | |
145 | コマンドラインに渡され、あるスイッチは渡されないといったことが起こります。 | |
146 | 146 | 注意しないと、文字が続かない "-" だけが渡されるといったことも |
147 | 147 | 起こり得ます。 |
148 | 148 | すべてのスイッチが、確実に 32 文字境界の前か後ろかのどちらかに |
149 | 149 | なるようにしたいことでしょう。 |
150 | 150 | 多くのスイッチは、余分に処理されても問題ありませんが、完全なスイッチの |
151 | 151 | 代わりに "-" が入っていた場合には、プログラムの代わりに、標準入力を Perl に |
152 | 152 | 実行させることになってしまいます。 |
153 | ||
153 | B<-I> スイッチが中途半端になった場合にもおかしな結果となり得ます。 | |
154 | おかしな結果となり得ます。 | |
155 | 154 | |
156 | 155 | =begin original |
157 | 156 | |
158 | 157 | Some switches do care if they are processed twice, for instance |
159 | combinations of | |
158 | combinations of B<-l> and B<-0>. Either put all the switches after | |
160 | ||
159 | the 32-character boundary (if applicable), or replace the use of | |
161 | ||
160 | B<-0>I<digits> by C<BEGIN{ $/ = "\0digits"; }>. | |
162 | C<BEGIN{ $/ = "\0digits"; }>. | |
163 | 161 | |
164 | 162 | =end original |
165 | 163 | |
166 | 2 回実行されることに注意する必要のあるスイッチもあります | |
164 | 2 回実行されることに注意する必要のあるスイッチもあります。 | |
167 | ||
165 | 例えば B<-l> と B<-0> の組み合わせです。 | |
168 | 166 | (可能なら) 両方のスイッチが 32 文字境界の後ろにいくようにするか、 |
169 | 167 | B<-0>I<digits> を C<BEGIN{ $/ = "\0digits"; }> で置き換えてください。 |
170 | 168 | |
171 | 169 | =begin original |
172 | 170 | |
173 | Parsing of the | |
171 | Parsing of the #! switches starts wherever "perl" is mentioned in the line. | |
174 | 172 | The sequences "-*" and "- " are specifically ignored so that you could, |
175 | 173 | if you were so inclined, say |
176 | 174 | |
177 | 175 | =end original |
178 | 176 | |
179 | ||
177 | #! スイッチの解析は、行内で "perl" が示された位置から始まります。 | |
180 | 178 | とりわけ "-*" と "- " という文字の並びは無視されますので、以下のように |
181 | 179 | 書くと: |
182 | 180 | |
183 | 181 | #!/bin/sh |
184 | #! -*- | |
182 | #! -*-perl-*- | |
185 | 183 | eval 'exec perl -x -wS $0 ${1+"$@"}' |
186 | 184 | if 0; |
187 | 185 | |
188 | 186 | =begin original |
189 | 187 | |
190 | to let Perl see the | |
188 | to let Perl see the B<-p> switch. | |
191 | 189 | |
192 | 190 | =end original |
193 | 191 | |
194 | Perl に | |
192 | Perl に B<-p> スイッチを渡すことができます。 | |
195 | 193 | |
196 | 194 | =begin original |
197 | 195 | |
198 | A similar trick involves the | |
196 | A similar trick involves the B<env> program, if you have it. | |
199 | 197 | |
200 | 198 | =end original |
201 | 199 | |
202 | 似たようなトリックは(持っていれば) | |
200 | 似たようなトリックは(持っていれば) B<env> プログラムでも使えます。 | |
203 | 201 | |
204 | 202 | #!/usr/bin/env perl |
205 | 203 | |
206 | 204 | =begin original |
207 | 205 | |
208 | 206 | The examples above use a relative path to the perl interpreter, |
209 | 207 | getting whatever version is first in the user's path. If you want |
210 | a specific version of Perl, say, perl5. | |
208 | a specific version of Perl, say, perl5.005_57, you should place | |
211 | that directly in the | |
209 | that directly in the #! line's path. | |
212 | 210 | |
213 | 211 | =end original |
214 | 212 | |
215 | 213 | 上の例は Perl インタプリタに相対パスを使って、 |
216 | 214 | ユーザーの PATH で最初にあったバージョンを使います。 |
217 | もし特定のバージョンの Perl、例えば perl5. | |
215 | もし特定のバージョンの Perl、例えば perl5.005_57 が使いたいなら、 | |
218 | ||
216 | #! 行のパスに直接書くべきです。 | |
219 | 217 | |
220 | 218 | =begin original |
221 | 219 | |
222 | If the | |
220 | If the #! line does not contain the word "perl", the program named after | |
223 | the | |
221 | the #! is executed instead of the Perl interpreter. This is slightly | |
224 | ||
222 | bizarre, but it helps people on machines that don't do #!, because they | |
225 | ||
223 | can tell a program that their SHELL is F</usr/bin/perl>, and Perl will then | |
226 | ||
224 | dispatch the program to the correct interpreter for them. | |
227 | interpreter for them. | |
228 | 225 | |
229 | 226 | =end original |
230 | 227 | |
231 | ||
228 | #! 行に "perl" という語が含まれていなければ、#! の後に指定された | |
232 | ||
229 | プログラムが Perl インタプリタの代わりに実行されます。 | |
233 | これは少し変わっていますが、 | |
230 | これは少し変わっていますが、#! が行なえないマシンを使っている方には | |
234 | 有効でしょう | |
231 | 有効でしょう。 | |
235 | ||
232 | プログラムに対して使っている SHELL が F</usr/bin/perl> だと言っておけば、 | |
233 | Perl が正しいインタプリタを起動してくれるからです。 | |
236 | 234 | |
237 | 235 | =begin original |
238 | 236 | |
239 | 237 | After locating your program, Perl compiles the entire program to an |
240 | 238 | internal form. If there are any compilation errors, execution of the |
241 | 239 | program is not attempted. (This is unlike the typical shell script, |
242 | 240 | which might run part-way through before finding a syntax error.) |
243 | 241 | |
244 | 242 | =end original |
245 | 243 | |
246 | 244 | プログラムの場所が特定できたなら、Perl はプログラム全体を内部形式に |
247 | 245 | コンパイルし始めます。 |
248 | 246 | コンパイルエラーが見つかった時には、プログラムの実行は行なわれません。 |
249 | 247 | (これは、構文エラーがある場合にも、途中まで実行される可能性のある、 |
250 | 248 | 典型的なシェルのスクリプトと異なる点です。) |
251 | 249 | |
252 | 250 | =begin original |
253 | 251 | |
254 | 252 | If the program is syntactically correct, it is executed. If the program |
255 | 253 | runs off the end without hitting an exit() or die() operator, an implicit |
256 | 254 | C<exit(0)> is provided to indicate successful completion. |
257 | 255 | |
258 | 256 | =end original |
259 | 257 | |
260 | 258 | プログラムが構文的に正しければ、実行されることになります。 |
261 | 259 | プログラムが、exit() 演算子にも die() 演算子にも当たらないで最後まで |
262 | 260 | 到達すると、正常に完了したことを示すために、暗黙の C<exit(0)> が |
263 | 261 | 行なわれます。 |
264 | 262 | |
265 | 263 | =head2 #! and quoting on non-Unix systems |
266 | 264 | X<hashbang> X<#!> |
267 | 265 | |
268 | 266 | (非 Unix システムでの #! とクォート) |
269 | 267 | |
270 | 268 | =begin original |
271 | 269 | |
272 | Unix's | |
270 | Unix's #! technique can be simulated on other systems: | |
273 | 271 | |
274 | 272 | =end original |
275 | 273 | |
276 | Unix の | |
274 | Unix の #! のテクニックは他のシステムでもシミュレートされています。 | |
277 | 275 | |
278 | 276 | =over 4 |
279 | 277 | |
280 | 278 | =item OS/2 |
281 | 279 | |
282 | 280 | =begin original |
283 | 281 | |
284 | 282 | Put |
285 | 283 | |
286 | 284 | =end original |
287 | 285 | |
288 | 286 | 以下のように |
289 | 287 | |
290 | 288 | extproc perl -S -your_switches |
291 | 289 | |
292 | 290 | =begin original |
293 | 291 | |
294 | as the first line in C<*.cmd> file ( | |
292 | as the first line in C<*.cmd> file (B<-S> due to a bug in cmd.exe's | |
295 | 293 | `extproc' handling). |
296 | 294 | |
297 | 295 | =end original |
298 | 296 | |
299 | C<*.cmd> ファイルの最初の行に書いてください ( | |
297 | C<*.cmd> ファイルの最初の行に書いてください (B<-S> は cmd.exe の | |
300 | 298 | `extproc' の扱いのバグを引き起こします)。 |
301 | 299 | |
302 | 300 | =item MS-DOS |
303 | 301 | |
304 | 302 | =begin original |
305 | 303 | |
306 | 304 | Create a batch file to run your program, and codify it in |
307 | 305 | C<ALTERNATE_SHEBANG> (see the F<dosish.h> file in the source |
308 | 306 | distribution for more information). |
309 | 307 | |
310 | 308 | =end original |
311 | 309 | |
312 | 310 | プログラムを実行するバッチファイルを作って、C<ALTERNATE_SHEBANG> で |
313 | 311 | コード化してください (さらなる情報についてはソース配布パッケージの |
314 | F<dosish.h> ファイルを参照して | |
312 | F<dosish.h> ファイルを参照して下さい)。 | |
315 | 313 | |
316 | 314 | =item Win95/NT |
317 | 315 | |
318 | 316 | =begin original |
319 | 317 | |
320 | 318 | The Win95/NT installation, when using the ActiveState installer for Perl, |
321 | 319 | will modify the Registry to associate the F<.pl> extension with the perl |
322 | 320 | interpreter. If you install Perl by other means (including building from |
323 | 321 | the sources), you may have to modify the Registry yourself. Note that |
324 | 322 | this means you can no longer tell the difference between an executable |
325 | 323 | Perl program and a Perl library file. |
326 | 324 | |
327 | 325 | =end original |
328 | 326 | |
329 | 327 | Win95/NT でのインストールにおいて、ActiveState の Perl 用インストーラを |
330 | 328 | 使った場合は、拡張子 F<.pl> を Perl インタプリタに関連付けるよう |
331 | 329 | レジストリを変更します。 |
332 | 330 | 他の方法で Perl をインストールした場合(ソースから構築した場合を含みます)、 |
333 | 331 | レジストリを自分で変更する必要があります。 |
334 | 332 | これは実行可能な Perl プログラムと Perl ライブラリファイルとの |
335 | 333 | 違いがなくなってしまうことに注意してください。 |
336 | 334 | |
335 | =item Macintosh | |
336 | ||
337 | =begin original | |
338 | ||
339 | Under "Classic" MacOS, a perl program will have the appropriate Creator and | |
340 | Type, so that double-clicking them will invoke the MacPerl application. | |
341 | Under Mac OS X, clickable apps can be made from any C<#!> script using Wil | |
342 | Sanchez' DropScript utility: http://www.wsanchez.net/software/ . | |
343 | ||
344 | =end original | |
345 | ||
346 | "Classic" MacOS では、perl プログラムは適切な Creator と Type を | |
347 | 持っているので、ダブルクリックすれば Perl アプリケーションを起動できます。 | |
348 | Mac OS X では、クリック可能なアプリケーションは、どんな C<#!> からでも | |
349 | Wil Sanchez' DropScript utility を使うことで作成できます: | |
350 | http://www.wsanchez.net/software/ 。 | |
351 | ||
337 | 352 | =item VMS |
338 | 353 | |
339 | 354 | =begin original |
340 | 355 | |
341 | 356 | Put |
342 | 357 | |
343 | 358 | =end original |
344 | 359 | |
345 | 360 | 以下のように |
346 | 361 | |
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; | |
349 | 364 | |
350 | 365 | =begin original |
351 | 366 | |
352 | 367 | at the top of your program, where B<-mysw> are any command line switches you |
353 | 368 | want to pass to Perl. You can now invoke the program directly, by saying |
354 | 369 | C<perl program>, or as a DCL procedure, by saying C<@program> (or implicitly |
355 | 370 | via F<DCL$PATH> by just using the name of the program). |
356 | 371 | |
357 | 372 | =end original |
358 | 373 | |
359 | プログラムの先頭に書いてください | |
374 | プログラムの先頭に書いてください。 | |
360 | コマンドラインスイッチです。 | |
375 | ここで B<-mysw> は Perl に渡したいコマンドラインスイッチです。 | |
361 | 376 | これで C<perl program> として直接プログラムを起動できますし、 |
362 | 377 | C<@program> として(あるいは F<DCL$PATH> 経由でプログラム名を使って) |
363 | 378 | DSL 手続きとして起動できます。 |
364 | 379 | |
365 | 380 | =begin original |
366 | 381 | |
367 | 382 | This incantation is a bit much to remember, but Perl will display it for |
368 | 383 | you if you say C<perl "-V:startperl">. |
369 | 384 | |
370 | 385 | =end original |
371 | 386 | |
372 | 387 | この決まり文句は覚えるには少々長すぎますが、C<perl "-V:startperl"> とすれば |
373 | 388 | Perl がこれを表示してくれます。 |
374 | 389 | |
375 | 390 | =back |
376 | 391 | |
377 | 392 | =begin original |
378 | 393 | |
379 | 394 | Command-interpreters on non-Unix systems have rather different ideas |
380 | 395 | on quoting than Unix shells. You'll need to learn the special |
381 | 396 | characters in your command-interpreter (C<*>, C<\> and C<"> are |
382 | 397 | common) and how to protect whitespace and these characters to run |
383 | one-liners (see | |
398 | one-liners (see B<-e> below). | |
384 | 399 | |
385 | 400 | =end original |
386 | 401 | |
387 | 非 Unix システムのコマンドインタプリタはクォートに関して | |
402 | 非 Unix システムのコマンドインタプリタはクォートに関して | |
388 | 異なった考え方をしています。 | |
403 | Unix シェルと異なった考え方をしています。 | |
389 | 404 | お使いのコマンドインタプリタの特殊文字について (C<*>, C<\>, C<"> は |
390 | 一般的です)、そして一行で起動するために(後述する | |
405 | 一般的です)、そして一行で起動するために(後述する B<-e> を参照して下さい) | |
391 | ||
406 | 空白や特殊文字を保護する方法について学ぶ必要があるでしょう。 | |
392 | 407 | |
393 | 408 | =begin original |
394 | 409 | |
395 | 410 | On some systems, you may have to change single-quotes to double ones, |
396 | 411 | which you must I<not> do on Unix or Plan 9 systems. You might also |
397 | 412 | have to change a single % to a %%. |
398 | 413 | |
399 | 414 | =end original |
400 | 415 | |
401 | 416 | システムによってはシングルクォートをダブルクォートに変更する必要が |
402 | あるかもしれません | |
417 | あるかもしれません。 | |
403 | I<してはいけません>。 | |
418 | しかし Unix や Plan9 のシステムでは I<してはいけません>。 | |
404 | 419 | また、単体の % を %% に変更する必要があるかもしれません。 |
405 | 420 | |
406 | 421 | =begin original |
407 | 422 | |
408 | 423 | For example: |
409 | 424 | |
410 | 425 | =end original |
411 | 426 | |
412 | 427 | 例えば: |
413 | 428 | |
414 | 429 | # Unix |
415 | 430 | perl -e 'print "Hello world\n"' |
416 | 431 | |
417 | 432 | # MS-DOS, etc. |
418 | 433 | perl -e "print \"Hello world\n\"" |
419 | 434 | |
435 | # Macintosh | |
436 | print "Hello world\n" | |
437 | (then Run "Myscript" or Shift-Command-R) | |
438 | ||
420 | 439 | # VMS |
421 | 440 | perl -e "print ""Hello world\n""" |
422 | 441 | |
423 | 442 | =begin original |
424 | 443 | |
425 | 444 | The problem is that none of this is reliable: it depends on the |
426 | command and it is entirely possible neither works. If | |
445 | command and it is entirely possible neither works. If B<4DOS> were | |
427 | 446 | the command shell, this would probably work better: |
428 | 447 | |
429 | 448 | =end original |
430 | 449 | |
431 | 問題は、これらはどれも信頼性がないことです | |
450 | 問題は、これらはどれも信頼性がないことです。 | |
432 | 動かないかもしれません。 | |
451 | これはコマンドに依存し、どれも動かないかもしれません。 | |
433 | ||
452 | B<4DOS> がコマンドシェルなら、おそらくよりよく動きます: | |
434 | 453 | |
435 | 454 | perl -e "print <Ctrl-x>"Hello world\n<Ctrl-x>"" |
436 | 455 | |
437 | 456 | =begin original |
438 | 457 | |
439 | 458 | B<CMD.EXE> in Windows NT slipped a lot of standard Unix functionality in |
440 | 459 | when nobody was looking, but just try to find documentation for its |
441 | 460 | quoting rules. |
442 | 461 | |
443 | 462 | =end original |
444 | 463 | |
445 | 464 | Windows NT の B<CMD.EXE> は誰も見ていない間に多くの標準 Unix 機能が |
446 | 465 | 入り込んでいますが、クォートのルールに関しては |
447 | 466 | ドキュメントを探してみてください。 |
448 | 467 | |
449 | 468 | =begin original |
450 | 469 | |
470 | Under the Macintosh, it depends which environment you are using. The MacPerl | |
471 | shell, or MPW, is much like Unix shells in its support for several | |
472 | quoting variants, except that it makes free use of the Macintosh's non-ASCII | |
473 | characters as control characters. | |
474 | ||
475 | =end original | |
476 | ||
477 | Macintosh では、使っている環境に依存します。 | |
478 | MacPerl shell や MPW はクォート関係の対応に関して | |
479 | かなり Unix シェルと似ています。 | |
480 | しかし、Macintosh の非 ASCII 文字をコントロール文字として | |
481 | 自由に使うことができます。 | |
482 | ||
483 | =begin original | |
484 | ||
451 | 485 | There is no general solution to all of this. It's just a mess. |
452 | 486 | |
453 | 487 | =end original |
454 | 488 | |
455 | 489 | この辺りのことに関する一般的な解決方法はありません。 |
456 | 490 | まったくぐちゃぐちゃです。 |
457 | 491 | |
458 | 492 | =head2 Location of Perl |
459 | 493 | X<perl, location of interpreter> |
460 | 494 | |
461 | 495 | (Perl の位置) |
462 | 496 | |
463 | 497 | =begin original |
464 | 498 | |
465 | 499 | It may seem obvious to say, but Perl is useful only when users can |
466 | 500 | easily find it. When possible, it's good for both F</usr/bin/perl> |
467 | 501 | and F</usr/local/bin/perl> to be symlinks to the actual binary. If |
468 | 502 | that can't be done, system administrators are strongly encouraged |
469 | 503 | to put (symlinks to) perl and its accompanying utilities into a |
470 | 504 | directory typically found along a user's PATH, or in some other |
471 | 505 | obvious and convenient place. |
472 | 506 | |
473 | 507 | =end original |
474 | 508 | |
475 | 509 | 当たり前のように聞こえるかもしれませんが、 |
476 | 510 | Perl はユーザーが簡単に発見できる場合にのみ有用です。 |
477 | 511 | 可能なら、F</usr/bin/perl> と F</usr/local/bin/perl> の両方に |
478 | 512 | 実際のバイナリへのシンボリックリンクを置くというのはよい考えです。 |
479 | 513 | もしこれが無理なら、システム管理者は Perl と付随するユーティリティ (への |
480 | 514 | シンボリックリンク) を、典型的にユーザーの PATH で見付かるディレクトリか、 |
481 | 515 | その他の明らかで便利な場所に置くべきです。 |
482 | 516 | |
483 | 517 | =begin original |
484 | 518 | |
485 | 519 | In this documentation, C<#!/usr/bin/perl> on the first line of the program |
486 | 520 | will stand in for whatever method works on your system. You are |
487 | 521 | advised to use a specific path if you care about a specific version. |
488 | 522 | |
489 | 523 | =end original |
490 | 524 | |
491 | 525 | このドキュメントでは、C<#!/usr/bin/perl> とプログラムの先頭に書けば |
492 | 526 | システムの全てのメソッドが実行できるものとしています。 |
493 | 527 | 特定のバージョンを使いたい場合は、特定のパスを使うか: |
494 | 528 | |
495 | #!/usr/local/bin/perl5. | |
529 | #!/usr/local/bin/perl5.00554 | |
496 | 530 | |
497 | 531 | =begin original |
498 | 532 | |
499 | 533 | or if you just want to be running at least version, place a statement |
500 | 534 | like this at the top of your program: |
501 | 535 | |
502 | 536 | =end original |
503 | 537 | |
504 | 538 | あるいは単に最低限のバージョンを指定した場合は、 |
505 | 539 | 以下のような行をプログラムの先頭に置いてください: |
506 | 540 | |
507 | use | |
541 | use 5.005_54; | |
508 | 542 | |
509 | 543 | =head2 Command Switches |
510 | 544 | X<perl, command switches> X<command switches> |
511 | 545 | |
512 | 546 | (コマンドスイッチ) |
513 | 547 | |
514 | 548 | =begin original |
515 | 549 | |
516 | 550 | As with all standard commands, a single-character switch may be |
517 | 551 | clustered with the following switch, if any. |
518 | 552 | |
519 | 553 | =end original |
520 | 554 | |
521 | 555 | 全ての標準コマンドと同様に、1 文字のスイッチは、次に続くスイッチが |
522 | 556 | あれば、それとつなげることができます。 |
523 | 557 | |
524 | 558 | #!/usr/bin/perl -spi.orig # same as -s -p -i.orig |
525 | 559 | |
526 | 560 | =begin original |
527 | 561 | |
528 | A C<--> signals the end of options and disables further option processing. Any | |
529 | arguments after the C<--> are treated as filenames and arguments. | |
530 | ||
531 | =end original | |
532 | ||
533 | C<--> はオプションの末尾を示してさらなるオプション処理を無効にします。 | |
534 | C<--> の後ろの引数は全てファイル名と引数として扱われます。 | |
535 | ||
536 | =begin original | |
537 | ||
538 | 562 | Switches include: |
539 | 563 | |
540 | 564 | =end original |
541 | 565 | |
542 | 566 | スイッチ一覧: |
543 | 567 | |
544 | 568 | =over 5 |
545 | 569 | |
546 | 570 | =item B<-0>[I<octal/hexadecimal>] |
547 | 571 | X<-0> X<$/> |
548 | 572 | |
549 | 573 | =begin original |
550 | 574 | |
551 | 575 | specifies the input record separator (C<$/>) as an octal or |
552 | 576 | hexadecimal number. If there are no digits, the null character is the |
553 | 577 | separator. Other switches may precede or follow the digits. For |
554 | example, if you have a version of | |
578 | example, if you have a version of B<find> which can print filenames | |
555 | 579 | terminated by the null character, you can say this: |
556 | 580 | |
557 | 581 | =end original |
558 | 582 | |
559 | 583 | 入力レコードセパレータ (C<$/>) を 8 進数または 16 進数で示します。 |
560 | 584 | digits を指定しないと、ヌル文字がセパレータになります。 |
561 | 585 | 他のスイッチを前に置いてもかまいませんし、digits のあとに |
562 | 586 | つなげてもかまいません。 |
563 | たとえば、ファイル名をヌル文字で区切って表示できる | |
587 | たとえば、ファイル名をヌル文字で区切って表示できる find があれば: | |
564 | 588 | |
565 | 589 | find . -name '*.orig' -print0 | perl -n0e unlink |
566 | 590 | |
567 | 591 | =begin original |
568 | 592 | |
569 | 593 | The special value 00 will cause Perl to slurp files in paragraph mode. |
594 | The value 0777 will cause Perl to slurp files whole because there is no | |
595 | legal byte with that value. | |
570 | 596 | |
571 | 597 | =end original |
572 | 598 | |
573 | 599 | 00 という特別な値は、Perl にパラグラフモードで、ファイルを読ませます。 |
600 | 0777 という値は、該当するバイトがないため、 | |
601 | Perl にファイル全体を読ませることになります。 | |
574 | 602 | |
575 | 603 | =begin original |
576 | 604 | |
577 | ||
605 | If you want to specify any Unicode character, use the hexadecimal | |
578 | the | |
606 | format: C<-0xHHH...>, where the C<H> are valid hexadecimal digits. | |
579 | is a s | |
607 | (This means that you cannot use the C<-x> with a directory name that | |
608 | consists of hexadecimal digits.) | |
580 | 609 | |
581 | 610 | =end original |
582 | 611 | |
583 | ||
612 | Unicode 文字を指定したい場合は、16 進数のフォーマット C<-0xHHH...> を | |
584 | ||
613 | 使ってください。 | |
585 | ||
614 | ここで C<H> は 16 進数として有効な文字です | |
615 | (これは C<-x> で 16 進数の数値からなるディレクトリ名を指定できない | |
616 | ことを意味します)。 | |
586 | 617 | |
587 | =begin original | |
588 | ||
589 | You can also specify the separator character using hexadecimal notation: | |
590 | B<-0xI<HHH...>>, where the C<I<H>> are valid hexadecimal digits. Unlike | |
591 | the octal form, this one may be used to specify any Unicode character, even | |
592 | those beyond 0xFF. So if you I<really> want a record separator of 0777, | |
593 | specify it as B<-0x1FF>. (This means that you cannot use the L</-x> option | |
594 | with a directory name that consists of hexadecimal digits, or else Perl | |
595 | will think you have specified a hex number to B<-0>.) | |
596 | ||
597 | =end original | |
598 | ||
599 | 16 進数の記法 B<-0xI<HHH...>> を使ってセパレータ文字を指定することもできます; | |
600 | ここで C<I<H>> は 16 進数として有効な文字です。 | |
601 | 8 進数形式と違って、これは 0xFF を超えたものを含む任意の Unicode 文字を | |
602 | 指定するために使われるかもしれません。 | |
603 | それで、I<本当に> 0777 のレコード区切りを使いたいなら、B<-0x1FF> として | |
604 | 指定してください。 | |
605 | (これは L</-x> オプションで 16 進数の数値からなるディレクトリ名を指定できない | |
606 | ことを意味します; さもなければ Perl は指定された 16 進数を B<-0> と | |
607 | 扱います。) | |
608 | ||
609 | 618 | =item B<-a> |
610 | 619 | X<-a> X<autosplit> |
611 | 620 | |
612 | 621 | =begin original |
613 | 622 | |
614 | turns on autosplit mode when used with a | |
623 | turns on autosplit mode when used with a B<-n> or B<-p>. An implicit | |
615 | 624 | split command to the @F array is done as the first thing inside the |
616 | implicit while loop produced by the | |
625 | implicit while loop produced by the B<-n> or B<-p>. | |
617 | 626 | |
618 | 627 | =end original |
619 | 628 | |
620 | ||
629 | B<-n> や B<-p> といっしょに用いると、自動 split モードになります。 | |
621 | ||
630 | B<-n> や B<-p> で作られる暗黙のループ内の最初の文として、 | |
622 | 631 | 配列 @F への暗黙の split コマンドが実行されます。 |
623 | 632 | |
624 | 633 | perl -ane 'print pop(@F), "\n";' |
625 | 634 | |
626 | 635 | =begin original |
627 | 636 | |
628 | 637 | is equivalent to |
629 | 638 | |
630 | 639 | =end original |
631 | 640 | |
632 | 641 | は以下のものと等価です。 |
633 | 642 | |
634 | 643 | while (<>) { |
635 | 644 | @F = split(' '); |
636 | 645 | print pop(@F), "\n"; |
637 | 646 | } |
638 | 647 | |
639 | 648 | =begin original |
640 | 649 | |
641 | An alternate delimiter may be specified using | |
650 | An alternate delimiter may be specified using B<-F>. | |
642 | 651 | |
643 | 652 | =end original |
644 | 653 | |
645 | ||
654 | B<-F> を使って区切文字を変更することができます。 | |
646 | 655 | |
647 | =begin original | |
648 | ||
649 | B<-a> implicitly sets L</-n>. | |
650 | ||
651 | =end original | |
652 | ||
653 | B<-a> は暗黙に L</-n> を設定します。 | |
654 | ||
655 | 656 | =item B<-C [I<number/list>]> |
656 | 657 | X<-C> |
657 | 658 | |
658 | 659 | =begin original |
659 | 660 | |
660 | The | |
661 | The C<-C> flag controls some of the Perl Unicode features. | |
661 | 662 | |
662 | 663 | =end original |
663 | 664 | |
664 | ||
665 | C<-C>フラグは Perl Unicode 機能のいくつかを制御します。 | |
665 | 666 | |
666 | 667 | =begin original |
667 | 668 | |
668 | As of 5.8.1, the | |
669 | As of 5.8.1, the C<-C> can be followed either by a number or a list | |
669 | 670 | of option letters. The letters, their numeric values, and effects |
670 | 671 | are as follows; listing the letters is equal to summing the numbers. |
671 | 672 | |
672 | 673 | =end original |
673 | 674 | |
674 | 5.8.1 から、 | |
675 | 5.8.1 から、C<-C> フラグは数値またはオプション文字のリストを | |
675 | 676 | つけることが出来ます。 |
676 | 677 | 指定可能な文字と数値およびその効果は以下の通りです; |
677 | 678 | 文字のリストは数値の合計と同じです。 |
678 | 679 | |
679 | 680 | =begin original |
680 | 681 | |
681 | 682 | I 1 STDIN is assumed to be in UTF-8 |
682 | 683 | O 2 STDOUT will be in UTF-8 |
683 | 684 | E 4 STDERR will be in UTF-8 |
684 | 685 | S 7 I + O + E |
685 | 686 | i 8 UTF-8 is the default PerlIO layer for input streams |
686 | 687 | o 16 UTF-8 is the default PerlIO layer for output streams |
687 | 688 | D 24 i + o |
688 | 689 | A 32 the @ARGV elements are expected to be strings encoded |
689 | 690 | in UTF-8 |
690 | L 64 normally the "IOEioA" are unconditional, | |
691 | L 64 normally the "IOEioA" are unconditional, | |
691 | them conditional on the locale environment | |
692 | the L makes them conditional on the locale environment | |
692 | (the LC_ALL, LC_ | |
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 | |
694 | 695 | 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 | | |
697 | debugging mode. | |
697 | 698 | |
698 | 699 | =end original |
699 | 700 | |
700 | 701 | I 1 STDIN は UTF-8 と仮定する |
701 | 702 | O 2 STDOUT は UTF-8 と仮定する |
702 | 703 | E 4 STDERR は UTF-8 と仮定する |
703 | 704 | S 7 I + O + E |
704 | 705 | i 8 UTF-8 は入力ストリームのデフォルト PerlIO 層 |
705 | 706 | o 16 UTF-8 は出力ストリームのデフォルト PerlIO 層 |
706 | 707 | D 24 i + o |
707 | 708 | A 32 @ARGV の要素は UTF-8 でエンコードされた文字列と推測する |
708 | 709 | L 64 通常は "IOEioA" は無条件ですが、 |
709 | L はロケール環境変数(LC_ALL, LC_ | |
710 | L はロケール環境変数(LC_ALL, LC_TYPE, LANG, 優先度順)によって | |
710 | 711 | 条件付きとなります -- もし変数が UTF-8 を示していれば、 |
711 | 712 | 選択された "IOEioA" が有効になります |
712 | 713 | a 256 デバッグモードで UTF-8 キャッシュコードを実行するために、 |
713 | 714 | ${^UTF8CACHE} を -1 にセットする。 |
714 | 715 | |
715 | 716 | =for documenting_the_underdocumented |
716 | 717 | perl.h gives W/128 as PERL_UNICODE_WIDESYSCALLS "/* for Sarathy */" |
717 | 718 | |
718 | 719 | =for todo |
719 | 720 | perltodo mentions Unicode in %ENV and filenames. I guess that these will be |
720 | 721 | options e and f (or F). |
721 | 722 | |
722 | 723 | =begin original |
723 | 724 | |
724 | For example, | |
725 | For example, C<-COE> and C<-C6> will both turn on UTF-8-ness on both | |
725 | 726 | STDOUT and STDERR. Repeating letters is just redundant, not cumulative |
726 | 727 | nor toggling. |
727 | 728 | |
728 | 729 | =end original |
729 | 730 | |
730 | 例えば、 | |
731 | 例えば、C<-COE> と C<-C6> はどちらも STDOUT と STDERR を UTF-8 化します。 | |
731 | 732 | 同じ文字を繰り返しても冗長なだけで、加算されたりトグルになったりはしません。 |
732 | 733 | |
733 | 734 | =begin original |
734 | 735 | |
735 | 736 | The C<io> options mean that any subsequent open() (or similar I/O |
736 | operations) | |
737 | operations) will have the C<:utf8> PerlIO layer implicitly applied | |
737 | ||
738 | to them, in other words, UTF-8 is expected from any input stream, | |
738 | ||
739 | and UTF-8 is produced to any output stream. This is just the default, | |
739 | th | |
740 | with explicit layers in open() and with binmode() one can manipulate | |
740 | ||
741 | streams as usual. | |
741 | manipulate streams as usual. This has no effect on code run in modules. | |
742 | 742 | |
743 | 743 | =end original |
744 | 744 | |
745 | C<io> オプションは | |
745 | C<io> オプションは引き続く open() (あるいは同様の I/O 操作) において | |
746 | ||
746 | 暗黙的に C<:utf8> PerlIO 層が適用されます。 | |
747 | 入力ストリームでは UTF-8 が想定され、出力ストリームは | |
747 | 言い換えると、入力ストリームでは UTF-8 が想定され、出力ストリームは | |
748 | ||
748 | UTF-8 で出力されます。 | |
749 | 通常どおり open() と binmode() で明示的に | |
749 | これは単にデフォルトであり、通常どおり open() と binmode() で明示的に | |
750 | ||
750 | 変更できます。 | |
751 | 751 | |
752 | 752 | =begin original |
753 | 753 | |
754 | ||
754 | C<-C> on its own (not followed by any number or option list), or the | |
755 | empty string C<""> for the | |
755 | empty string C<""> for the C<PERL_UNICODE> environment variable, has the | |
756 | same effect as | |
756 | same effect as C<-CSDL>. In other words, the standard I/O handles and | |
757 | the default C<open()> layer are UTF-8-fied | |
757 | the default C<open()> layer are UTF-8-fied B<but> only if the locale | |
758 | 758 | environment variables indicate a UTF-8 locale. This behaviour follows |
759 | 759 | the 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>.) | |
761 | 760 | |
762 | 761 | =end original |
763 | 762 | |
764 | ||
763 | C<-C> が単体で(数値やオプションリストなし)起動されるか、 | |
765 | ||
764 | C<PERL_UNICODE> 環境変数が空文字列 C<""> の場合、C<-CSDL> と | |
766 | 765 | 同じ効果となります。 |
767 | 766 | 言い換えると、標準 I/O 操作とデフォルトの C<open()> 層はロケール環境変数が |
768 | UTF-8 ロケールを示している場合 | |
767 | UTF-8 ロケールを示している場合 B<のみ> UTF-8 化されます。 | |
769 | 768 | この振る舞いは Perl 5.8.0 での I<暗黙の> (そして問題のある) UTF-8 に |
770 | 769 | 関する振る舞いと同じです。 |
771 | (L<perl581delta/UTF-8 no longer default under UTF-8 locales> を | |
772 | 参照してください。) | |
773 | 770 | |
774 | 771 | =begin original |
775 | 772 | |
776 | You can use | |
773 | You can use C<-C0> (or C<"0"> for C<PERL_UNICODE>) to explicitly | |
777 | 774 | disable all the above Unicode features. |
778 | 775 | |
779 | 776 | =end original |
780 | 777 | |
781 | ||
778 | C<-C0> (あるいは C<PERL_UNICODE> に C<"0">) を指定すると | |
782 | 779 | 明示的に上記の全ての Unicode 機能を無効にします。 |
783 | 780 | |
784 | 781 | =begin original |
785 | 782 | |
786 | 783 | The read-only magic variable C<${^UNICODE}> reflects the numeric value |
787 | of this setting. This variable is set during Perl startup and is | |
784 | of this setting. This is variable is set during Perl startup and is | |
788 | 785 | thereafter read-only. If you want runtime effects, use the three-arg |
789 | 786 | open() (see L<perlfunc/open>), the two-arg binmode() (see L<perlfunc/binmode>), |
790 | 787 | and the C<open> pragma (see L<open>). |
791 | 788 | |
792 | 789 | =end original |
793 | 790 | |
794 | 791 | 読み込み専用のマジック変数 C<${^UNICODE}> にこの設定の数値表現が |
795 | 792 | 反映されます。 |
796 | 793 | これは Perl 起動時にセットされる変数で、読み込み専用です。 |
797 | 794 | 実行中に効果を得たい場合は、3 引数の open() (L<perlfunc/open> 参照), |
798 | 795 | 2 引数の binmode() (L<perlfunc/binmode> 参照), C<open> プラグマ |
799 | 796 | (L<open> 参照) を使ってください。 |
800 | 797 | |
801 | 798 | =begin original |
802 | 799 | |
803 | (In Perls earlier than 5.8.1 the | |
800 | (In Perls earlier than 5.8.1 the C<-C> switch was a Win32-only switch | |
804 | 801 | that enabled the use of Unicode-aware "wide system call" Win32 APIs. |
805 | 802 | This feature was practically unused, however, and the command line |
806 | 803 | switch was therefore "recycled".) |
807 | 804 | |
808 | 805 | =end original |
809 | 806 | |
810 | (5.8.1 以前の Perl では | |
807 | (5.8.1 以前の Perl では C<-C> スイッチは Win32 専用のスイッチで、 | |
811 | 808 | Unicode 対応の "ワイド文字システムコール" Win32 API を使うためのものでした。 |
812 | 809 | この機能は事実上使われませんでしたが、コマンドラインスイッチは |
813 | 810 | "再利用" されました。) |
814 | 811 | |
815 | 812 | =begin original |
816 | 813 | |
817 | B<Note:> Since perl 5.10.1, if the | |
814 | B<Note:> Since perl 5.10.1, if the -C option is used on the #! line, it | |
818 | ||
815 | must be specified on the command line as well, since the standard streams | |
819 | 816 | are already set up at this point in the execution of the perl interpreter. |
820 | 817 | You can also use binmode() to set the encoding of an I/O stream. |
821 | 818 | |
822 | 819 | =end original |
823 | 820 | |
824 | B<注意:> perl 5.10.1 から、 | |
821 | B<注意:> perl 5.10.1 から、-C スイッチが #! 行で使われると、 | |
825 | 822 | コマンドラインでも指定しなければなりません; なぜなら標準ストリームは |
826 | 823 | perl インタプリタ実行のこの地点で既に設定されているからです。 |
827 | 824 | I/O ストリームのエンコーディングの設定に binmode() も使えます。 |
828 | 825 | |
829 | 826 | =item B<-c> |
830 | 827 | X<-c> |
831 | 828 | |
832 | 829 | =begin original |
833 | 830 | |
834 | 831 | causes Perl to check the syntax of the program and then exit without |
835 | executing it. Actually, it I<will> execute | |
832 | executing it. Actually, it I<will> execute C<BEGIN>, C<UNITCHECK>, | |
836 | ||
833 | C<CHECK>, and C<use> blocks, because these are considered as occurring | |
837 | o | |
834 | outside the execution of your program. C<INIT> and C<END> blocks, | |
838 | ||
835 | however, will be skipped. | |
839 | 836 | |
840 | 837 | =end original |
841 | 838 | |
842 | 839 | Perl にスクリプトの構文のチェックを行なわせ、実行せずに |
843 | 840 | 終了するようにします。 |
844 | 実際には、C<BEGIN>, C<UNITCHECK>, C<CHECK> | |
841 | 実際には、C<BEGIN>, C<UNITCHECK>, C<CHECK>, C<use> ブロックは | |
845 | I<実行します> | |
842 | I<実行します>。 | |
846 | 考えられ | |
843 | これらはプログラムの実行の外側にあるものと考えられるからです。 | |
847 | 844 | C<INIT> と C<END> ブロックはスキップされます。 |
848 | 845 | |
849 | =begin original | |
850 | ||
851 | If the syntax check is successful perl will exit with a status of zero | |
852 | and report C<I<yourprogram> syntax OK>. On failure perl will print | |
853 | any detected errors and exit with a non-zero status. | |
854 | ||
855 | =end original | |
856 | ||
857 | 構文チェックが成功すると、終了コード 0 で終了し、 | |
858 | C<I<yourprogram> syntax OK> と返します。 | |
859 | 失敗時は、perl は検出したエラーを表示し、非 0 終了コードで終了します。 | |
860 | ||
861 | 846 | =item B<-d> |
862 | 847 | X<-d> X<-dt> |
863 | 848 | |
864 | 849 | =item B<-dt> |
865 | 850 | |
866 | 851 | =begin original |
867 | 852 | |
868 | 853 | runs the program under the Perl debugger. See L<perldebug>. |
869 | 854 | If B<t> is specified, it indicates to the debugger that threads |
870 | 855 | will be used in the code being debugged. |
871 | 856 | |
872 | 857 | =end original |
873 | 858 | |
874 | 859 | Perl デバッガの下でプログラムを実行します。 |
875 | 860 | L<perldebug> を参照してください。 |
876 | 861 | B<t> が指定されると、デバッグするコードがスレッドを使っていることを |
877 | 862 | デバッガに示します。 |
878 | 863 | |
879 | =item B<-d:>I< | |
864 | =item B<-d:>I<foo[=bar,baz]> | |
880 | 865 | X<-d> X<-dt> |
881 | 866 | |
882 | =item B<-dt:>I< | |
867 | =item B<-dt:>I<foo[=bar,baz]> | |
883 | 868 | |
884 | 869 | =begin original |
885 | 870 | |
886 | runs the program under the control of a debugging, profiling, or | |
871 | runs the program under the control of a debugging, profiling, or | |
887 | module installed as | |
872 | tracing module installed as Devel::foo. E.g., B<-d:DProf> executes | |
888 | program using the | |
873 | the program using the Devel::DProf profiler. As with the B<-M> | |
889 | flag, options may be passed to the | |
874 | flag, options may be passed to the Devel::foo package where they | |
890 | be received and interpreted by the | |
875 | will be received and interpreted by the Devel::foo::import routine. | |
891 | ||
876 | The comma-separated list of options must follow a C<=> character. | |
892 | ||
877 | If B<t> is specified, it indicates to the debugger that threads | |
893 | ||
878 | will be used in the code being debugged. | |
894 | ||
879 | See L<perldebug>. | |
895 | 880 | |
896 | 881 | =end original |
897 | 882 | |
898 | ||
883 | Devel::foo としてインストールされる デバッグ・プロファイリング・ | |
899 | 884 | トレースモジュールの制御下でプログラムを実行します。 |
900 | つまり、B<-d:DProf> は | |
885 | つまり、B<-d:DProf> は Devel::DProf プロファイラを使って | |
901 | 886 | プログラムを実行します。 |
902 | ||
887 | B<-M> フラグと共に使うと、オプションは Devel::foo パッケージに渡され、 | |
903 | ||
888 | Devel::foo::import ルーチンで解釈されます。 | |
904 | 解釈されます。 | |
905 | 再び、B<-M> と同様、インポートではなく C<Devel::I<MOD>::unimport> を | |
906 | 呼び出すには -B<-d:-I<MOD>> を使ってください。 | |
907 | 889 | オプションをコンマ区切りのリストにするときは C<=> の文字の後に |
908 | 890 | 続けなければなりません。 |
909 | 891 | B<t> が指定されると、デバッグするコードがスレッドを使っていることを |
910 | 892 | デバッガに示します。 |
911 | L<perldebug> を参照して | |
893 | L<perldebug> を参照して下さい。 | |
912 | 894 | |
913 | 895 | =item B<-D>I<letters> |
914 | 896 | X<-D> X<DEBUGGING> X<-DDEBUGGING> |
915 | 897 | |
916 | 898 | =item B<-D>I<number> |
917 | 899 | |
918 | 900 | =begin original |
919 | 901 | |
920 | sets debugging flags. T | |
902 | sets debugging flags. To watch how it executes your program, use | |
921 | ||
903 | B<-Dtls>. (This works only if debugging is compiled into your | |
922 | ||
904 | Perl.) Another nice value is B<-Dx>, which lists your compiled | |
905 | syntax tree. And B<-Dr> displays compiled regular expressions; | |
906 | the format of the output is explained in L<perldebguts>. | |
923 | 907 | |
924 | 908 | =end original |
925 | 909 | |
926 | 910 | デバッグフラグを設定します。 |
927 | ||
911 | スクリプトがどのように実行されるかを見るには、B<-Dtls> を使ってください。 | |
928 | ||
912 | (これは、デバッグ機能を盛り込んでコンパイルしたときにだけ働きます。) | |
929 | ||
930 | =begin original | |
931 | ||
932 | For example, to watch how perl executes your program, use B<-Dtls>. | |
933 | Another nice value is B<-Dx>, which lists your compiled syntax tree, and | |
934 | B<-Dr> displays compiled regular expressions; the format of the output is | |
935 | explained in L<perldebguts>. | |
936 | ||
937 | =end original | |
938 | ||
939 | 例えば、スクリプトがどのように実行されるかを見るには、B<-Dtls> を | |
940 | 使ってください。 | |
941 | 913 | この他に役に立つ値としては、コンパイルされた構文ツリーを表示する、 |
942 | B<-Dx> があげられます | |
914 | B<-Dx> があげられます。 | |
943 | B<-Dr> は、コンパイルした正規表現を表示します | |
915 | B<-Dr> は、コンパイルした正規表現を表示します。 | |
944 | L<perldebguts> に説明があります。 | |
916 | 出力形式については L<perldebguts> に説明があります。 | |
945 | 917 | |
946 | 918 | =begin original |
947 | 919 | |
948 | 920 | As an alternative, specify a number instead of list of letters (e.g., |
949 | 921 | B<-D14> is equivalent to B<-Dtls>): |
950 | 922 | |
951 | 923 | =end original |
952 | 924 | |
953 | 925 | 文字のリストの代わりに数字を指定することもできます |
954 | 926 | (たとえば、B<-D14> は B<-Dtls> と等価です): |
955 | 927 | |
956 | 928 | =begin original |
957 | 929 | |
958 | | |
930 | 1 p Tokenizing and parsing (with v, displays parse stack) | |
959 | stack) | |
931 | 2 s Stack snapshots (with v, displays all stacks) | |
960 | | |
932 | 4 l Context (loop) stack processing | |
961 | | |
933 | 8 t Trace execution | |
962 | | |
934 | 16 o Method and overloading resolution | |
963 | | |
935 | 32 c String/numeric conversions | |
964 | | |
936 | 64 P Print profiling info, preprocessor command for -P, source file input state | |
965 | | |
937 | 128 m Memory and SV allocation | |
966 | | |
938 | 256 f Format processing | |
967 | | |
939 | 512 r Regular expression parsing and execution | |
968 | | |
940 | 1024 x Syntax tree dump | |
969 | | |
941 | 2048 u Tainting checks | |
970 | | |
942 | 4096 U Unofficial, User hacking (reserved for private, unreleased use) | |
971 | | |
943 | 8192 H Hash dump -- usurps values() | |
972 | | |
944 | 16384 X Scratchpad allocation | |
973 | | |
945 | 32768 D Cleaning up | |
974 | | |
946 | 65536 S Thread synchronization | |
975 | | |
947 | 131072 T Tokenising | |
976 | | |
948 | 262144 R Include reference counts of dumped variables (eg when using -Ds) | |
977 | | |
949 | 524288 J Do not s,t,P-debug (Jump over) opcodes within package DB | |
978 | | |
950 | 1048576 v Verbose: use in conjunction with other flags | |
979 | | |
951 | 2097152 C Copy On Write | |
980 | | |
952 | 4194304 A Consistency checks on internal structures | |
981 | | |
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 | |
998 | 954 | |
999 | 955 | =end original |
1000 | 956 | |
1001 | | |
957 | 1 p トークン化と構文解析 (v と併用されると、パーススタックの表示) | |
1002 | | |
958 | 2 s スタックの表示 (v と併用されると、全てのスタックの表示) | |
1003 | | |
959 | 4 l コンテキスト(ループ)スタックの処理 | |
1004 | | |
960 | 8 t 実行のトレース | |
1005 | | |
961 | 16 o メソッドとオーバーロードの解決 | |
1006 | | |
962 | 32 c 文字列/数値変換 | |
1007 | | |
963 | 64 P プロファイリング情報、-P のためのプリプロセッサコマンド、ソースファイル入力状態の表示 | |
1008 | | |
964 | 128 m メモリと SV の配置 | |
1009 | | |
965 | 256 f フォーマットの処理 | |
1010 | | |
966 | 512 r 正規表現の解析と実効 | |
1011 | | |
967 | 1024 x 構文トリーのダンプ | |
1012 | | |
968 | 2048 u 汚染チェック | |
1013 | | |
969 | 4096 U 非公式な、ユーザーハック (プライベートな、リリースされない利用法のために予約) | |
1014 | | |
970 | 8192 H ハッシュのダンプ -- values() の横取り | |
1015 | | |
971 | 16384 X スクラッチパッドの配置 | |
1016 | | |
972 | 32768 D 全消去 | |
1017 | | |
973 | 65536 S スレッド同期 | |
1018 | | |
974 | 131072 T トークン化 | |
1019 | | |
975 | 262144 R ダンプされた変数のリファレンスカウントを含む(-Dsのとき) | |
1020 | | |
976 | 524288 J DB パッケージの中では s,t,P デバッグコードを実行しない | |
1021 | | |
977 | 1048576 v 詳細: 他のフラグと組み合わせて使う | |
1022 | | |
978 | 2097152 C コピーオンライト | |
1023 | | |
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/// のコンパイルと実行をトレース | |
1034 | 981 | |
1035 | 982 | =begin original |
1036 | 983 | |
1037 | 984 | All these flags require B<-DDEBUGGING> when you compile the Perl |
1038 | executable (but see | |
985 | executable (but see L<Devel::Peek>, L<re> which may change this). | |
1039 | ||
986 | See the F<INSTALL> file in the Perl source distribution | |
1040 | ||
987 | for how to do this. This flag is automatically set if you include B<-g> | |
1041 | ||
988 | option when C<Configure> asks you about optimizer/debugger flags. | |
1042 | 989 | |
1043 | 990 | =end original |
1044 | 991 | |
1045 | 992 | これらの全てのフラグは Perl 実行ファイルをコンパイルするときに |
1046 | 993 | B<-DDEBUGGING> が指定されている必要があります |
1047 | (但しこれを変更する | |
994 | (但しこれを変更するときは L<Devel::Peek>, L<re> を参照してください)。 | |
1048 | L<re/'debug' mode> を参照してください)。 | |
1049 | 995 | そうするためにどうすればいいかについては Perl のソース配布パッケージの |
1050 | ||
996 | F<INSTALL> ファイルを参照して下さい。 | |
997 | このフラグは C<Configure> が最適化/デバッガフラグを尋ねたときに | |
998 | B<-g> オプション込みで指定すれば自動的にセットされます。 | |
1051 | 999 | |
1052 | 1000 | =begin original |
1053 | 1001 | |
1054 | 1002 | If you're just trying to get a print out of each line of Perl code |
1055 | 1003 | as it executes, the way that C<sh -x> provides for shell scripts, |
1056 | 1004 | you can't use Perl's B<-D> switch. Instead do this |
1057 | 1005 | |
1058 | 1006 | =end original |
1059 | 1007 | |
1060 | 1008 | シェルスクリプトにおける C<sh -x> のように、単に今実行している Perl の |
1061 | 1009 | コードを表示したい場合は、Perl の B<-D> スイッチは使えません。 |
1062 | 1010 | 代わりに以下のようにしてください: |
1063 | 1011 | |
1064 | 1012 | # If you have "env" utility |
1065 | 1013 | env PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program |
1066 | 1014 | |
1067 | 1015 | # Bourne shell syntax |
1068 | 1016 | $ PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program |
1069 | 1017 | |
1070 | 1018 | # csh syntax |
1071 | 1019 | % (setenv PERLDB_OPTS "NonStop=1 AutoTrace=1 frame=2"; perl -dS program) |
1072 | 1020 | |
1073 | 1021 | =begin original |
1074 | 1022 | |
1075 | 1023 | See L<perldebug> for details and variations. |
1076 | 1024 | |
1077 | 1025 | =end original |
1078 | 1026 | |
1079 | 詳細とバリエーションについては L<perldebug> を参照して | |
1027 | 詳細とバリエーションについては L<perldebug> を参照して下さい。 | |
1080 | 1028 | |
1081 | 1029 | =item B<-e> I<commandline> |
1082 | 1030 | X<-e> |
1083 | 1031 | |
1084 | 1032 | =begin original |
1085 | 1033 | |
1086 | 1034 | may be used to enter one line of program. If B<-e> is given, Perl |
1087 | 1035 | will not look for a filename in the argument list. Multiple B<-e> |
1088 | 1036 | commands may be given to build up a multi-line script. Make sure |
1089 | 1037 | to use semicolons where you would in a normal program. |
1090 | 1038 | |
1091 | 1039 | =end original |
1092 | 1040 | |
1093 | 1041 | 1 行のプログラムを指定するのに使用します。 |
1094 | 1042 | B<-e> が指定されると Perl は引数のリストからはファイル名を探しません。 |
1095 | 1043 | 複数の -e コマンドで、複数行のスクリプトを構成することができます。 |
1096 | 1044 | 通常のプログラムでセミコロンを置くところには、セミコロンを使うことに |
1097 | 1045 | 気を付けてください。 |
1098 | 1046 | |
1099 | 1047 | =item B<-E> I<commandline> |
1100 | 1048 | X<-E> |
1101 | 1049 | |
1102 | 1050 | =begin original |
1103 | 1051 | |
1104 | behaves just like | |
1052 | behaves just like B<-e>, except that it implicitly enables all | |
1105 | ||
1053 | optional features (in the main compilation unit). See L<feature>. | |
1106 | compilation unit). See L<feature> and L<builtin>. | |
1107 | 1054 | |
1108 | 1055 | =end original |
1109 | 1056 | |
1110 | ||
1057 | B<-e> と同様に振る舞いますが、暗黙に全てのオプション機能を(main | |
1111 | ||
1058 | コンパイル単位で)有効にします。 | |
1112 | L<feature> | |
1059 | L<feature> を参照してください。 | |
1113 | 1060 | |
1114 | 1061 | =item B<-f> |
1115 | X<-f> | |
1062 | X<-f> | |
1116 | 1063 | |
1117 | 1064 | =begin original |
1118 | 1065 | |
1119 | 1066 | Disable executing F<$Config{sitelib}/sitecustomize.pl> at startup. |
1120 | 1067 | |
1121 | 1068 | =end original |
1122 | 1069 | |
1123 | 1070 | 起動時の F<$Config{sitelib}/sitecustomize.pl> の実行を無効化します。 |
1124 | 1071 | |
1125 | 1072 | =begin original |
1126 | 1073 | |
1127 | 1074 | Perl can be built so that it by default will try to execute |
1128 | 1075 | F<$Config{sitelib}/sitecustomize.pl> at startup (in a BEGIN block). |
1129 | This is a hook that allows the sysadmin to customize how | |
1076 | This is a hook that allows the sysadmin to customize how perl behaves. | |
1130 | It can for instance be used to add entries to the @INC array to make | |
1077 | It can for instance be used to add entries to the @INC array to make perl | |
1131 | 1078 | find modules in non-standard locations. |
1132 | 1079 | |
1133 | 1080 | =end original |
1134 | 1081 | |
1135 | 1082 | Perl は実行時に (BEGIN ブロックの中で) デフォルトで |
1136 | 1083 | F<$Config{sitelib}/sitecustomize.pl> を実行しようとさせるように |
1137 | 1084 | ビルドできます。 |
1138 | これはシステム管理者が、 | |
1085 | これはシステム管理者が、perl がどのように振る舞うかをカスタマイズするための | |
1139 | 1086 | フックです。 |
1140 | 例えば、 | |
1087 | 例えば、perl が非標準の位置にあるモジュールを見つけられるように @INC 配列に | |
1141 | 1088 | エントリを追加するために使えます。 |
1142 | 1089 | |
1143 | =begin original | |
1144 | ||
1145 | Perl actually inserts the following code: | |
1146 | ||
1147 | =end original | |
1148 | ||
1149 | Perl は実際には以下のコードを挿入します: | |
1150 | ||
1151 | BEGIN { | |
1152 | do { local $!; -f "$Config{sitelib}/sitecustomize.pl"; } | |
1153 | && do "$Config{sitelib}/sitecustomize.pl"; | |
1154 | } | |
1155 | ||
1156 | =begin original | |
1157 | ||
1158 | Since it is an actual C<do> (not a C<require>), F<sitecustomize.pl> | |
1159 | doesn't need to return a true value. The code is run in package C<main>, | |
1160 | in its own lexical scope. However, if the script dies, C<$@> will not | |
1161 | be 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 | ||
1172 | The value of C<$Config{sitelib}> is also determined in C code and not | |
1173 | read from C<Config.pm>, which is not loaded. | |
1174 | ||
1175 | =end original | |
1176 | ||
1177 | C<$Config{sitelib}> の値は C コードで決定され、C<Config.pm> は | |
1178 | 読み込まれないので、ここの値は使われません。 | |
1179 | ||
1180 | =begin original | |
1181 | ||
1182 | The code is executed I<very> early. For example, any changes made to | |
1183 | C<@INC> will show up in the output of `perl -V`. Of course, C<END> | |
1184 | blocks 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 | ||
1194 | To determine at runtime if this capability has been compiled in your | |
1195 | perl, you can check the value of C<$Config{usesitecustomize}>. | |
1196 | ||
1197 | =end original | |
1198 | ||
1199 | この機能がコンパイルされているかどうかを実行時に決定するために、 | |
1200 | C<$Config{usesitecustomize}> の値をチェックできます。 | |
1201 | ||
1202 | 1090 | =item B<-F>I<pattern> |
1203 | 1091 | X<-F> |
1204 | 1092 | |
1205 | 1093 | =begin original |
1206 | 1094 | |
1207 | specifies the pattern to split on f | |
1095 | specifies the pattern to split on if B<-a> is also in effect. The | |
1208 | surrounded by C<//>, C<"">, or C<''>, otherwise it will b | |
1096 | pattern may be surrounded by C<//>, C<"">, or C<''>, otherwise it will be | |
1209 | quotes. You can't use literal whitespace | |
1097 | put in single quotes. You can't use literal whitespace in the pattern. | |
1210 | 1098 | |
1211 | 1099 | =end original |
1212 | 1100 | |
1213 | ||
1101 | B<-a> も有効なときに、split を行なう正規表現を指定します。 | |
1214 | 1102 | パターンは C<//>, C<"">, C<''> で囲むか、シングルクォートの中に書きます。 |
1215 | パターン中にリテラルな空白 | |
1103 | パターン中にリテラルな空白は使えません。 | |
1216 | 1104 | |
1217 | =begin original | |
1218 | ||
1219 | B<-F> implicitly sets both L</-a> and L</-n>. | |
1220 | ||
1221 | =end original | |
1222 | ||
1223 | B<-F> は暗黙に L</-a> と L</-n> の両方を設定します。 | |
1224 | ||
1225 | =item B<-g> | |
1226 | X<-g> | |
1227 | ||
1228 | =begin original | |
1229 | ||
1230 | undefines the input record separator (C<L<$E<sol>|perlvar/$E<sol>>>) and thus | |
1231 | enables the slurp mode. In other words, it causes Perl to read whole | |
1232 | files 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 | ||
1243 | This 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 | ||
1251 | Mnemonics: gobble, grab, gulp. | |
1252 | ||
1253 | =end original | |
1254 | ||
1255 | 記憶法: gobble, grab, gulp. | |
1256 | ||
1257 | 1105 | =item B<-h> |
1258 | 1106 | X<-h> |
1259 | 1107 | |
1260 | 1108 | =begin original |
1261 | 1109 | |
1262 | 1110 | prints a summary of the options. |
1263 | 1111 | |
1264 | 1112 | =end original |
1265 | 1113 | |
1266 | 1114 | オプションの一覧を表示します。 |
1267 | 1115 | |
1268 | =item B<-?> | |
1269 | X<-?> | |
1270 | ||
1271 | =begin original | |
1272 | ||
1273 | synonym for B<-h>: prints a summary of the options. | |
1274 | ||
1275 | =end original | |
1276 | ||
1277 | B<-h> の同義語: オプションの一覧を表示します。 | |
1278 | ||
1279 | 1116 | =item B<-i>[I<extension>] |
1280 | 1117 | X<-i> X<in-place> |
1281 | 1118 | |
1282 | 1119 | =begin original |
1283 | 1120 | |
1284 | 1121 | specifies that files processed by the C<E<lt>E<gt>> construct are to be |
1285 | 1122 | edited in-place. It does this by renaming the input file, opening the |
1286 | 1123 | output file by the original name, and selecting that output file as the |
1287 | 1124 | default for print() statements. The extension, if supplied, is used to |
1288 | 1125 | modify the name of the old file to make a backup copy, following these |
1289 | 1126 | rules: |
1290 | 1127 | |
1291 | 1128 | =end original |
1292 | 1129 | |
1293 | 1130 | C<E<lt>E<gt>> の構文で処理されたファイルを置き換えるための拡張子を |
1294 | 1131 | 指定します。 |
1295 | 1132 | これは、入力ファイルをリネームし、元の名前で出力ファイルを open し、 |
1296 | 1133 | print() 文のデフォルトとしてその出力ファイルを select することで行ないます。 |
1297 | 1134 | extension が指定されると、昔の内容のバックアップを行なう |
1298 | 1135 | ファイル名の拡張子として、元のファイル名に付け加えられます。 |
1299 | 1136 | |
1300 | 1137 | =begin original |
1301 | 1138 | |
1302 | If no extension is supplied, | |
1139 | If no extension is supplied, no backup is made and the current file is | |
1303 | ||
1140 | overwritten. | |
1304 | a new file with the original I<filename>. When perl exits, cleanly or not, | |
1305 | the original I<file> is unlinked. | |
1306 | 1141 | |
1307 | 1142 | =end original |
1308 | 1143 | |
1309 | extension が指定され | |
1144 | extension が指定されないと、バックアップを作らず、現在のファイルが | |
1310 | ||
1145 | 上書きされます。 | |
1311 | リダイレクトされます。 | |
1312 | クリーンかどうかに関わらず、perl が終了した時点で、元の I<file> は | |
1313 | アンリンクされます。 | |
1314 | 1146 | |
1315 | 1147 | =begin original |
1316 | 1148 | |
1317 | 1149 | If the extension doesn't contain a C<*>, then it is appended to the |
1318 | 1150 | end of the current filename as a suffix. If the extension does |
1319 | 1151 | contain one or more C<*> characters, then each C<*> is replaced |
1320 | 1152 | with the current filename. In Perl terms, you could think of this |
1321 | 1153 | as: |
1322 | 1154 | |
1323 | 1155 | =end original |
1324 | 1156 | |
1325 | 1157 | extension に C<*> が含まれていない場合、現在のファイル名の末尾に |
1326 | 1158 | 接尾子として付け加えられます。 |
1327 | 1159 | extension に一つ以上の C<*> の文字がある場合、 |
1328 | 1160 | それぞれの C<*> は現在のファイル名で置き換えられます。 |
1329 | 1161 | Perl 的に書くと、以下のようになります: |
1330 | 1162 | |
1331 | 1163 | ($backup = $extension) =~ s/\*/$file_name/g; |
1332 | 1164 | |
1333 | 1165 | =begin original |
1334 | 1166 | |
1335 | 1167 | This allows you to add a prefix to the backup file, instead of (or in |
1336 | 1168 | addition to) a suffix: |
1337 | 1169 | |
1338 | 1170 | =end original |
1339 | 1171 | |
1340 | 1172 | 以下のようにすると、(接尾子の代わりに、あるいは接尾子に加えて) |
1341 | 1173 | バックアップファイルに接頭子をつけることができます。 |
1342 | 1174 | |
1343 | $ perl -pi'orig_*' -e 's/bar/baz/' fileA | |
1175 | $ perl -pi'orig_*' -e 's/bar/baz/' fileA # backup to 'orig_fileA' | |
1344 | # 'orig_fileA' | |
1345 | 1176 | |
1346 | 1177 | =begin original |
1347 | 1178 | |
1348 | 1179 | Or even to place backup copies of the original files into another |
1349 | 1180 | directory (provided the directory already exists): |
1350 | 1181 | |
1351 | 1182 | =end original |
1352 | 1183 | |
1353 | 1184 | 元のファイルのバックアップコピーを(既にある)他のディレクトリに作ることも |
1354 | 1185 | できます: |
1355 | 1186 | |
1356 | $ perl -pi'old/*.orig' -e 's/bar/baz/' fileA | |
1187 | $ perl -pi'old/*.orig' -e 's/bar/baz/' fileA # backup to 'old/fileA.orig' | |
1357 | # 'old/fileA.orig' | |
1358 | 1188 | |
1359 | 1189 | =begin original |
1360 | 1190 | |
1361 | 1191 | These sets of one-liners are equivalent: |
1362 | 1192 | |
1363 | 1193 | =end original |
1364 | 1194 | |
1365 | 1195 | 以下の一行スクリプトは全て等価です: |
1366 | 1196 | |
1367 | $ perl -pi -e 's/bar/baz/' fileA | |
1197 | $ perl -pi -e 's/bar/baz/' fileA # overwrite current file | |
1368 | $ perl -pi'*' -e 's/bar/baz/' fileA | |
1198 | $ perl -pi'*' -e 's/bar/baz/' fileA # overwrite current file | |
1369 | 1199 | |
1370 | $ perl -pi'.orig' -e 's/bar/baz/' fileA | |
1200 | $ perl -pi'.orig' -e 's/bar/baz/' fileA # backup to 'fileA.orig' | |
1371 | $ perl -pi'*.orig' -e 's/bar/baz/' fileA | |
1201 | $ perl -pi'*.orig' -e 's/bar/baz/' fileA # backup to 'fileA.orig' | |
1372 | 1202 | |
1373 | 1203 | =begin original |
1374 | 1204 | |
1375 | 1205 | From the shell, saying |
1376 | 1206 | |
1377 | 1207 | =end original |
1378 | 1208 | |
1379 | 1209 | シェルから以下のように起動すると: |
1380 | 1210 | |
1381 | 1211 | $ perl -p -i.orig -e "s/foo/bar/; ... " |
1382 | 1212 | |
1383 | 1213 | =begin original |
1384 | 1214 | |
1385 | 1215 | is the same as using the program: |
1386 | 1216 | |
1387 | 1217 | =end original |
1388 | 1218 | |
1389 | 1219 | プログラムで以下のようにするのと同じで: |
1390 | 1220 | |
1391 | 1221 | #!/usr/bin/perl -pi.orig |
1392 | 1222 | s/foo/bar/; |
1393 | 1223 | |
1394 | 1224 | =begin original |
1395 | 1225 | |
1396 | 1226 | which is equivalent to |
1397 | 1227 | |
1398 | 1228 | =end original |
1399 | 1229 | |
1400 | 1230 | 以下とほぼ等価です: |
1401 | 1231 | |
1402 | 1232 | #!/usr/bin/perl |
1403 | 1233 | $extension = '.orig'; |
1404 | 1234 | LINE: while (<>) { |
1405 | 1235 | if ($ARGV ne $oldargv) { |
1406 | 1236 | if ($extension !~ /\*/) { |
1407 | 1237 | $backup = $ARGV . $extension; |
1408 | 1238 | } |
1409 | 1239 | else { |
1410 | 1240 | ($backup = $extension) =~ s/\*/$ARGV/g; |
1411 | 1241 | } |
1412 | 1242 | rename($ARGV, $backup); |
1413 | 1243 | open(ARGVOUT, ">$ARGV"); |
1414 | 1244 | select(ARGVOUT); |
1415 | 1245 | $oldargv = $ARGV; |
1416 | 1246 | } |
1417 | 1247 | s/foo/bar/; |
1418 | 1248 | } |
1419 | 1249 | continue { |
1420 | 1250 | print; # this prints to original filename |
1421 | 1251 | } |
1422 | 1252 | select(STDOUT); |
1423 | 1253 | |
1424 | 1254 | =begin original |
1425 | 1255 | |
1426 | 1256 | except that the B<-i> form doesn't need to compare $ARGV to $oldargv to |
1427 | 1257 | know when the filename has changed. It does, however, use ARGVOUT for |
1428 | 1258 | the selected filehandle. Note that STDOUT is restored as the default |
1429 | 1259 | output filehandle after the loop. |
1430 | 1260 | |
1431 | 1261 | =end original |
1432 | 1262 | |
1433 | 1263 | 違うのは、B<-i> の形式が、いつファイル名が変わったかを知るために、 |
1434 | 1264 | $ARGV と $oldargv を比較する必要がないことです。 |
1435 | 1265 | しかしながら、選択するファイルハンドルとして ARGVOUT は使用します。 |
1436 | 1266 | ループのあとは、STDOUT がデフォルトのファイルハンドルとして再設定されます。 |
1437 | 1267 | |
1438 | 1268 | =begin original |
1439 | 1269 | |
1440 | 1270 | As shown above, Perl creates the backup file whether or not any output |
1441 | 1271 | is actually changed. So this is just a fancy way to copy files: |
1442 | 1272 | |
1443 | 1273 | =end original |
1444 | 1274 | |
1445 | 1275 | 上述の通り、Perl はバックアップファイルを実際に出力が変更されたかどうかに |
1446 | 1276 | 関わらず作成します。 |
1447 | 1277 | 従って、以下はファイルをコピーする変わった方法となります: |
1448 | 1278 | |
1449 | 1279 | $ perl -p -i'/some/file/path/*' -e 1 file1 file2 file3... |
1450 | 1280 | or |
1451 | 1281 | $ perl -p -i'.orig' -e 1 file1 file2 file3... |
1452 | 1282 | |
1453 | 1283 | =begin original |
1454 | 1284 | |
1455 | 1285 | You can use C<eof> without parentheses to locate the end of each input |
1456 | 1286 | file, in case you want to append to each file, or reset line numbering |
1457 | 1287 | (see example in L<perlfunc/eof>). |
1458 | 1288 | |
1459 | 1289 | =end original |
1460 | 1290 | |
1461 | 1291 | 個々のファイルの終わりに何かを付け加えたいときや、行番号を |
1462 | 1292 | リセットしたいような場合に、個々の入力ファイルの終わりを知るために、 |
1463 | 括弧の無い C<eof> を使うことができます | |
1293 | 括弧の無い C<eof> を使うことができます。 | |
1464 | 参照してください | |
1294 | (L<perlfunc/eof> の例を参照してください。) | |
1465 | 1295 | |
1466 | 1296 | =begin original |
1467 | 1297 | |
1468 | 1298 | If, for a given file, Perl is unable to create the backup file as |
1469 | 1299 | specified in the extension then it will skip that file and continue on |
1470 | 1300 | with the next one (if it exists). |
1471 | 1301 | |
1472 | 1302 | =end original |
1473 | 1303 | |
1474 | 1304 | 与えられたファイルに対して、Perl が指定された拡張子でバックアップファイルを |
1475 | 1305 | 作れない場合、そのファイルはスキップされて(もしあれば)次のファイルに |
1476 | 1306 | 移って継続します。 |
1477 | 1307 | |
1478 | 1308 | =begin original |
1479 | 1309 | |
1480 | For a discussion of issues surrounding file permissions and B<-i>, | |
1310 | For a discussion of issues surrounding file permissions and B<-i>, | |
1481 | L<perlfaq5/Why does Perl let me delete read-only files? Why does -i clobber | |
1311 | see L<perlfaq5/Why does Perl let me delete read-only files? Why does -i clobber protected files? Isn't this a bug in Perl?>. | |
1482 | protected files? Isn't this a bug in Perl?>. | |
1483 | 1312 | |
1484 | 1313 | =end original |
1485 | 1314 | |
1486 | 1315 | ファイルのパーミッションと B<-i> に関する議論については、 |
1487 | 1316 | L<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 | 参照して下さい。 | |
1489 | 1318 | |
1490 | 1319 | =begin original |
1491 | 1320 | |
1492 | 1321 | You cannot use B<-i> to create directories or to strip extensions from |
1493 | 1322 | files. |
1494 | 1323 | |
1495 | 1324 | =end original |
1496 | 1325 | |
1497 | 1326 | B<-i> は、ディレクトリを作ったり、ファイルの拡張子を取り除いたりは |
1498 | 1327 | できません。 |
1499 | 1328 | |
1500 | 1329 | =begin original |
1501 | 1330 | |
1502 | 1331 | Perl does not expand C<~> in filenames, which is good, since some |
1503 | 1332 | folks use it for their backup files: |
1504 | 1333 | |
1505 | 1334 | =end original |
1506 | 1335 | |
1507 | Perl は C<~> を展開しません | |
1336 | Perl は C<~> を展開しません。 | |
1508 | 作る人々のためにはよいことです。 | |
1337 | これはバックアップファイルを以下のようにして作る人々のためにはよいことです。 | |
1509 | 1338 | |
1510 | 1339 | $ perl -pi~ -e 's/foo/bar/' file1 file2 file3... |
1511 | 1340 | |
1512 | 1341 | =begin original |
1513 | 1342 | |
1514 | 1343 | Note that because B<-i> renames or deletes the original file before |
1515 | creating a new file of the same name, U | |
1344 | creating a new file of the same name, UNIX-style soft and hard links will | |
1516 | 1345 | not be preserved. |
1517 | 1346 | |
1518 | 1347 | =end original |
1519 | 1348 | |
1520 | 1349 | B<-i> は同じ名前で新しいファイルを作る前に元のファイルをリネームまたは |
1521 | 削除するので、U | |
1350 | 削除するので、UNIX 形式のソフトリンクやハードリンクは保存されないことに | |
1522 | 1351 | 注意してください。 |
1523 | 1352 | |
1524 | 1353 | =begin original |
1525 | 1354 | |
1526 | 1355 | Finally, the B<-i> switch does not impede execution when no |
1527 | 1356 | files are given on the command line. In this case, no backup is made |
1528 | 1357 | (the original file cannot, of course, be determined) and processing |
1529 | 1358 | proceeds from STDIN to STDOUT as might be expected. |
1530 | 1359 | |
1531 | 1360 | =end original |
1532 | 1361 | |
1533 | 1362 | 最後に、B<-i> スイッチは、コマンドラインでファイルが指定されなくても |
1534 | 1363 | 実行を妨げません。 |
1535 | 1364 | この場合、バックアップファイルは作成されず(もちろん、元のファイルが |
1536 | 1365 | 決定できません)、予想通り、STDIN から STDOUT に処理が行われます。 |
1537 | 1366 | |
1538 | 1367 | =item B<-I>I<directory> |
1539 | 1368 | X<-I> X<@INC> |
1540 | 1369 | |
1541 | 1370 | =begin original |
1542 | 1371 | |
1543 | 1372 | Directories specified by B<-I> are prepended to the search path for |
1544 | modules (C<@INC>) | |
1373 | modules (C<@INC>), and also tells the C preprocessor where to search for | |
1374 | include files. The C preprocessor is invoked with B<-P>; by default it | |
1375 | searches /usr/include and /usr/lib/perl. | |
1545 | 1376 | |
1546 | 1377 | =end original |
1547 | 1378 | |
1548 | 1379 | B<-I> で指定されたディレクトリはモジュールの検索パス(C<@INC>)に |
1549 | 加えられます。 | |
1380 | 加えられ、また C プリプロセッサにインクルードファイルを探す場所を示します。 | |
1381 | C プリプロセッサは B<-P> で起動されます。 | |
1382 | デフォルトでは /usr/include と /usr/lib/perl を探します。 | |
1550 | 1383 | |
1551 | 1384 | =item B<-l>[I<octnum>] |
1552 | 1385 | X<-l> X<$/> X<$\> |
1553 | 1386 | |
1554 | 1387 | =begin original |
1555 | 1388 | |
1556 | 1389 | enables automatic line-ending processing. It has two separate |
1557 | 1390 | effects. First, it automatically chomps C<$/> (the input record |
1558 | separator) when used with | |
1391 | separator) when used with B<-n> or B<-p>. Second, it assigns C<$\> | |
1559 | 1392 | (the output record separator) to have the value of I<octnum> so |
1560 | 1393 | that any print statements will have that separator added back on. |
1561 | 1394 | If I<octnum> is omitted, sets C<$\> to the current value of |
1562 | 1395 | C<$/>. For instance, to trim lines to 80 columns: |
1563 | 1396 | |
1564 | 1397 | =end original |
1565 | 1398 | |
1566 | 1399 | 自動の行末処理を行なうようにします。 |
1567 | 1400 | これには、2 つの独立した機能があります。 |
1568 | 1 つには、 | |
1401 | 1 つには、B<-n> や B<-p> を使ったときに、自動的に C<$/>(入力レコード | |
1569 | 1402 | セパレータ)を chomp します。 |
1570 | 1403 | 2 つめに octnum を C<$\>(出力レコードセパレータ) に代入し、print 文で |
1571 | 1404 | セパレータを追加できるようにします。 |
1572 | 1405 | octnum を指定しなかった場合には、その時点の C<$/> の値をC<$\> に |
1573 | 1406 | 設定します。 |
1574 | 1407 | たとえば、行を 80 カラムに切り詰めるには以下のようにします: |
1575 | 1408 | |
1576 | 1409 | perl -lpe 'substr($_, 80) = ""' |
1577 | 1410 | |
1578 | 1411 | =begin original |
1579 | 1412 | |
1580 | 1413 | Note that the assignment C<$\ = $/> is done when the switch is processed, |
1581 | 1414 | so the input record separator can be different than the output record |
1582 | separator if the B<-l> switch is followed by a | |
1415 | separator if the B<-l> switch is followed by a B<-0> switch: | |
1583 | L<-0|/-0[octalE<sol>hexadecimal]> switch: | |
1584 | 1416 | |
1585 | 1417 | =end original |
1586 | 1418 | |
1587 | 1419 | C<$\ = $/> という代入は、B<-l> スイッチが処理されるときに |
1588 | 1420 | 実行されるときに行なわれますので、B<-l> スイッチの後に |
1589 | ||
1421 | B<-0> スイッチを置くようにすれば、入力レコードセパレータを、 | |
1590 | 入力レコードセパレータを、 | |
1591 | 1422 | 出力レコードセパレータと違うようにもできます: |
1592 | 1423 | |
1593 | 1424 | gnufind / -print0 | perl -ln0e 'print "found $_" if -p' |
1594 | 1425 | |
1595 | 1426 | =begin original |
1596 | 1427 | |
1597 | 1428 | This sets C<$\> to newline and then sets C<$/> to the null character. |
1598 | 1429 | |
1599 | 1430 | =end original |
1600 | 1431 | |
1601 | 1432 | これはまず、C<$\> に改行 (C<$/> のデフォルト値) を設定し、 |
1602 | 1433 | それから C<$/> にヌル文字を設定します。 |
1603 | 1434 | |
1604 | 1435 | =item B<-m>[B<->]I<module> |
1605 | 1436 | X<-m> X<-M> |
1606 | 1437 | |
1607 | 1438 | =item B<-M>[B<->]I<module> |
1608 | 1439 | |
1609 | 1440 | =item B<-M>[B<->]I<'module ...'> |
1610 | 1441 | |
1611 | 1442 | =item B<-[mM]>[B<->]I<module=arg[,arg]...> |
1612 | 1443 | |
1613 | 1444 | =begin original |
1614 | 1445 | |
1615 | 1446 | B<-m>I<module> executes C<use> I<module> C<();> before executing your |
1616 | program. | |
1447 | program. | |
1617 | so does not import subroutines and does not give effect to a pragma. | |
1618 | 1448 | |
1619 | 1449 | =end original |
1620 | 1450 | |
1621 | 1451 | B<-m>I<module> はプログラムの実行前に C<use> I<module> C<();> を |
1622 | 1452 | 実行します。 |
1623 | これはモジュールを読み込みますが、その C<import> メソッドは呼び出さないので、 | |
1624 | サブルーチンをインポートすることはできず、プラグマの効果もありません。 | |
1625 | 1453 | |
1626 | 1454 | =begin original |
1627 | 1455 | |
1628 | 1456 | B<-M>I<module> executes C<use> I<module> C<;> before executing your |
1629 | program. | |
1457 | program. You can use quotes to add extra code after the module name, | |
1630 | ||
1458 | e.g., C<'-Mmodule qw(foo bar)'>. | |
1631 | or giving effect to a pragma. | |
1632 | You can use quotes to add extra code after the module name, | |
1633 | e.g., C<'-MI<MODULE> qw(foo bar)'>. | |
1634 | 1459 | |
1635 | 1460 | =end original |
1636 | 1461 | |
1637 | 1462 | B<-M>I<module> はプログラムの実行前に C<use> I<module> C<;> を実行します。 |
1638 | ||
1463 | モジュール名の後ろに追加のコードを加えるためにクォートを使うこともできます。 | |
1639 | ||
1464 | つまり C<'-Mmodule qw(foo bar)'> などです。 | |
1640 | デフォルトの効果が引き起こされます。 | |
1641 | モジュール名の後ろに追加のコードを加えるためにクォートを使うこともできます; | |
1642 | つまり C<'-MI<MODULE> qw(foo bar)'> などです。 | |
1643 | 1465 | |
1644 | 1466 | =begin original |
1645 | 1467 | |
1646 | If the first character after the B<-M> or B<-m> is a dash ( | |
1468 | If the first character after the B<-M> or B<-m> is a dash (C<->) | |
1647 | 1469 | then the 'use' is replaced with 'no'. |
1648 | This makes no difference for B<-m>. | |
1649 | 1470 | |
1650 | 1471 | =end original |
1651 | 1472 | |
1652 | B<-M> または B<-m> の後の最初の文字がダッシュ( | |
1473 | B<-M> または B<-m> の後の最初の文字がダッシュ(C<->)の場合、 | |
1653 | 1474 | 'use' の代わりに 'no' が使われます。 |
1654 | これは B<-m> で違いはありません。 | |
1655 | 1475 | |
1656 | 1476 | =begin original |
1657 | 1477 | |
1658 | Since Perl version 5.39.8, the C<-M> switch and the module name can now | |
1659 | be passed in separate command-line arguments: | |
1660 | ||
1661 | =end original | |
1662 | ||
1663 | Perl バージョン 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 | ||
1671 | 1478 | A little builtin syntactic sugar means you can also say |
1672 | B<-m | |
1479 | B<-mmodule=foo,bar> or B<-Mmodule=foo,bar> as a shortcut for | |
1673 | ||
1480 | C<'-Mmodule qw(foo bar)'>. This avoids the need to use quotes when | |
1674 | importing symbols. The actual code generated by B<-M | |
1481 | importing symbols. The actual code generated by B<-Mmodule=foo,bar> is | |
1675 | 1482 | C<use module split(/,/,q{foo,bar})>. Note that the C<=> form |
1676 | removes the distinction between B<-m> and B<-M> | |
1483 | removes the distinction between B<-m> and B<-M>. | |
1677 | B<-mI<MODULE>=foo,bar> is the same as B<-MI<MODULE>=foo,bar>. | |
1678 | 1484 | |
1679 | 1485 | =end original |
1680 | 1486 | |
1681 | 小さい組み込みのシンタックスシュガーとして、 | |
1487 | 小さい組み込みのシンタックスシュガーとして、 C<'-Mmodule qw(foo bar)'> の | |
1682 | 代わりに B<-m | |
1488 | 代わりに B<-mmodule=foo,bar> または B<-Mmodule=foo,bar> と | |
1683 | 1489 | 書くことができます。 |
1684 | 1490 | これで、インポートするシンボルにクォートを使わなくてもよいようになります。 |
1685 | B<-M | |
1491 | B<-Mmodule=foo,bar> で生成される実際のコードは | |
1686 | 1492 | C<use module split(/,/,q{foo,bar})> です。 |
1687 | C<=> の形は B<-m> と B<-M> の間の違いを取り除くことに注意してください | |
1493 | C<=> の形は B<-m> と B<-M> の間の違いを取り除くことに注意してください。 | |
1688 | これは、B<-mI<MODULE>=foo,bar> は B<-MI<MODULE>=foo,bar> と | |
1689 | 同じということです。 | |
1690 | 1494 | |
1691 | 1495 | =begin original |
1692 | 1496 | |
1693 | A consequence of th | |
1497 | A consequence of this is that B<-MFoo=number> never does a version check | |
1694 | ||
1498 | (unless C<Foo::import()> itself is set up to do a version check, which | |
1695 | u | |
1499 | could happen for example if Foo inherits from Exporter.) | |
1696 | could happen for example if I<MODULE> inherits from L<Exporter>. | |
1697 | 1500 | |
1698 | 1501 | =end original |
1699 | 1502 | |
1700 | ||
1503 | この結果、(例えば Foo が Exporter を継承していたりして、 | |
1701 | C< | |
1504 | C<Foo::import()> 自身がバージョンチェックを行うように設定されていない限り) | |
1702 | B<-M | |
1505 | B<-MFoo=number> は決してバージョンチェックは行いません。 | |
1703 | 1506 | |
1704 | 1507 | =item B<-n> |
1705 | 1508 | X<-n> |
1706 | 1509 | |
1707 | 1510 | =begin original |
1708 | 1511 | |
1709 | 1512 | causes Perl to assume the following loop around your program, which |
1710 | makes it iterate over filename arguments somewhat like | |
1513 | makes it iterate over filename arguments somewhat like B<sed -n> or | |
1711 | ||
1514 | B<awk>: | |
1712 | 1515 | |
1713 | 1516 | =end original |
1714 | 1517 | |
1715 | 1518 | 以下のようなループが、実際のプログラムの回りにあるかのように Perl に |
1716 | 指示します | |
1519 | 指示します。 | |
1520 | B<sed -n> や B<awk> のようにファイル名引数上で繰り返しを | |
1717 | 1521 | 行なうことになります: |
1718 | 1522 | |
1719 | 1523 | LINE: |
1720 | 1524 | while (<>) { |
1721 | 1525 | ... # your program goes here |
1722 | 1526 | } |
1723 | 1527 | |
1724 | 1528 | =begin original |
1725 | 1529 | |
1726 | Note that the lines are not printed by default. See | |
1530 | Note that the lines are not printed by default. See B<-p> to have | |
1727 | 1531 | lines printed. If a file named by an argument cannot be opened for |
1728 | 1532 | some reason, Perl warns you about it and moves on to the next file. |
1729 | 1533 | |
1730 | 1534 | =end original |
1731 | 1535 | |
1732 | 1536 | デフォルトでは、各行が印字されることはありません。 |
1733 | 各行の印字を行なうには | |
1537 | 各行の印字を行なうには B<-p> を参照してください。 | |
1734 | 1538 | 引数で指定されたファイルがなんらかの理由でオープンできなかった場合、 |
1735 | 1539 | Perl は警告を出して次のファイルに移ります。 |
1736 | 1540 | |
1737 | 1541 | =begin original |
1738 | 1542 | |
1739 | 1543 | Also note that C<< <> >> passes command line arguments to |
1740 | 1544 | L<perlfunc/open>, which doesn't necessarily interpret them as file names. |
1741 | 1545 | See L<perlop> for possible security implications. |
1742 | 1546 | |
1743 | 1547 | =end original |
1744 | 1548 | |
1745 | 1549 | また、C<< <> >> はコマンドライン引数を L<perlfunc/open> に渡し、これは |
1746 | 1550 | ファイル名として解釈する必要はないことに注意してください。 |
1747 | 1551 | 可能性のあるセキュリティの影響については L<perlop> を参照してください。 |
1748 | 1552 | |
1749 | 1553 | =begin original |
1750 | 1554 | |
1751 | 1555 | Here is an efficient way to delete all files that haven't been modified for |
1752 | 1556 | at least a week: |
1753 | 1557 | |
1754 | 1558 | =end original |
1755 | 1559 | |
1756 | 1560 | 以下にあげるのは、少なくとも 1 週間以上更新されていないファイルを効率的に |
1757 | 1561 | 削除するものです: |
1758 | 1562 | |
1759 | 1563 | find . -mtime +7 -print | perl -nle unlink |
1760 | 1564 | |
1761 | 1565 | =begin original |
1762 | 1566 | |
1763 | This is faster than using the B<-exec> switch of | |
1567 | This is faster than using the B<-exec> switch of B<find> because you don't | |
1764 | have to start a process on every filename found | |
1568 | have to start a process on every filename found. It does suffer from | |
1765 | th | |
1569 | the bug of mishandling newlines in pathnames, which you can fix if | |
1766 | ||
1570 | you follow the example under B<-0>. | |
1767 | you can fix if you follow the example under | |
1768 | L<-0|/-0[octalE<sol>hexadecimal]>. | |
1769 | 1571 | |
1770 | 1572 | =end original |
1771 | 1573 | |
1772 | 1574 | これは、ファイル名が見つかるごとにプロセスを起動しなくて済みますので、 |
1773 | ||
1575 | B<find> の B<-exec> スイッチを使うよりも速くなります。 | |
1774 | (しかし、より新しい I<find> で利用可能な B<-delete> オプションを使うより | |
1775 | 速くはないです)。 | |
1776 | 1576 | これはパス名に改行コードがあるとうまく扱えないバグの影響を受けますので、 |
1777 | ||
1577 | B<-O> の例に従うことで修正できます。 | |
1778 | 1578 | |
1779 | 1579 | =begin original |
1780 | 1580 | |
1781 | 1581 | C<BEGIN> and C<END> blocks may be used to capture control before or after |
1782 | the implicit program loop, just as in | |
1582 | the implicit program loop, just as in B<awk>. | |
1783 | 1583 | |
1784 | 1584 | =end original |
1785 | 1585 | |
1786 | ||
1586 | B<awk> と同じように、暗黙に実行されるプログラムループの前後に実行される | |
1787 | 1587 | コードを指定するために、C<BEGIN> ブロックと C<END> ブロックを |
1788 | 1588 | 使うことができます。 |
1789 | 1589 | |
1790 | 1590 | =item B<-p> |
1791 | 1591 | X<-p> |
1792 | 1592 | |
1793 | 1593 | =begin original |
1794 | 1594 | |
1795 | 1595 | causes Perl to assume the following loop around your program, which |
1796 | makes it iterate over filename arguments somewhat like | |
1596 | makes it iterate over filename arguments somewhat like B<sed>: | |
1797 | 1597 | |
1798 | 1598 | =end original |
1799 | 1599 | |
1800 | 以下のようなループが、実際のプログラムの回りにあるかのように | |
1600 | 以下のようなループが、実際のプログラムの回りにあるかのように | |
1801 | 指示します | |
1601 | Perl に指示します。 | |
1802 | なります: | |
1602 | B<sed> のようにファイル名引数上で繰り返しを行なうことになります: | |
1803 | 1603 | |
1804 | 1604 | LINE: |
1805 | 1605 | while (<>) { |
1806 | 1606 | ... # your program goes here |
1807 | 1607 | } continue { |
1808 | 1608 | print or die "-p destination: $!\n"; |
1809 | 1609 | } |
1810 | 1610 | |
1811 | 1611 | =begin original |
1812 | 1612 | |
1813 | 1613 | If a file named by an argument cannot be opened for some reason, Perl |
1814 | 1614 | warns you about it, and moves on to the next file. Note that the |
1815 | 1615 | lines are printed automatically. An error occurring during printing is |
1816 | treated as fatal. To suppress printing use the | |
1616 | treated as fatal. To suppress printing use the B<-n> switch. A B<-p> | |
1817 | 1617 | overrides a B<-n> switch. |
1818 | 1618 | |
1819 | 1619 | =end original |
1820 | 1620 | |
1821 | 1621 | 引数で指定されたファイルが何らかの理由でオープンできない場合、 |
1822 | 1622 | Perl は警告を出し、次のファイルに移ります。 |
1823 | 1623 | 各行は、自動的に印字されることになります。 |
1824 | 1624 | 印字中のエラーは致命的とみなされます。 |
1825 | 印字を抑制するには、 | |
1625 | 印字を抑制するには、B<-n> スイッチを使ってください。 | |
1826 | 1626 | B<-p> は B<-n> スイッチを無効にします。 |
1827 | 1627 | |
1828 | 1628 | =begin original |
1829 | 1629 | |
1830 | 1630 | C<BEGIN> and C<END> blocks may be used to capture control before or after |
1831 | the implicit loop, just as in | |
1631 | the implicit loop, just as in B<awk>. | |
1832 | 1632 | |
1833 | 1633 | =end original |
1834 | 1634 | |
1835 | ||
1635 | B<awk> と同じように、暗黙に実行されるループの前後に実行されるコードを | |
1836 | 1636 | 指定するために、C<BEGIN> ブロックと C<END> ブロックを使うことができます。 |
1837 | 1637 | |
1638 | =item B<-P> | |
1639 | X<-P> | |
1640 | ||
1641 | =begin original | |
1642 | ||
1643 | B<NOTE: Use of -P is strongly discouraged because of its inherent | |
1644 | problems, including poor portability. It is deprecated and will be | |
1645 | removed in a future version of Perl.> | |
1646 | ||
1647 | =end original | |
1648 | ||
1649 | B<注意: -P の使用は全く薦められません。 | |
1650 | なぜなら低い移植性を含む、先天的な問題があるからです。 | |
1651 | これは非推奨であり、将来のバージョンの Perl では取り除かれます。> | |
1652 | ||
1653 | =begin original | |
1654 | ||
1655 | This option causes your program to be run through the C preprocessor before | |
1656 | compilation by Perl. Because both comments and B<cpp> directives begin | |
1657 | with the # character, you should avoid starting comments with any words | |
1658 | recognized by the C preprocessor such as C<"if">, C<"else">, or C<"define">. | |
1659 | ||
1660 | =end original | |
1661 | ||
1662 | Perl によるコンパイルを行なう前に、スクリプトを C プリプロセッサに | |
1663 | かけるようにします。 | |
1664 | コメントも cpp のディレクティブも # で始まりますから、コメントの最初を | |
1665 | C プリプロセッサが認識してしまう C<"if">, C<"else">, C<"define">といった | |
1666 | 単語で始めるべきではありません。 | |
1667 | ||
1668 | =begin original | |
1669 | ||
1670 | If you're considering using C<-P>, you might also want to look at the | |
1671 | Filter::cpp module from CPAN. | |
1672 | ||
1673 | =end original | |
1674 | ||
1675 | C<-P> を使うことを考えているなら、CPAN にある Filter::cpp も | |
1676 | 参照したほうがよいでしょう。 | |
1677 | ||
1678 | =begin original | |
1679 | ||
1680 | The 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 | ||
1692 | The C<#!> line is stripped, so any switches there don't apply. | |
1693 | ||
1694 | =end original | |
1695 | ||
1696 | C<#!> 行が取り除かれるので、全てのスイッチは適用されません。 | |
1697 | ||
1698 | =item * | |
1699 | ||
1700 | =begin original | |
1701 | ||
1702 | A C<-P> on a C<#!> line doesn't work. | |
1703 | ||
1704 | =end original | |
1705 | ||
1706 | C<#!> 行に C<-P> を書いても動作しません。 | |
1707 | ||
1708 | =item * | |
1709 | ||
1710 | =begin original | |
1711 | ||
1712 | B<All> lines that begin with (whitespace and) a C<#> but | |
1713 | do not look like cpp commands, are stripped, including anything | |
1714 | inside Perl strings, regular expressions, and here-docs . | |
1715 | ||
1716 | =end original | |
1717 | ||
1718 | (空白と) C<#> で始まり、cpp コマンドでない B<全ての> 行は取り除かれます。 | |
1719 | Perl 文字列や正規表現やヒヤドキュメントのと途中でも、です。 | |
1720 | ||
1721 | =item * | |
1722 | ||
1723 | =begin original | |
1724 | ||
1725 | In some platforms the C preprocessor knows too much: it knows about | |
1726 | the C++ -style until-end-of-line comments starting with C<"//">. | |
1727 | This will cause problems with common Perl constructs like | |
1728 | ||
1729 | =end original | |
1730 | ||
1731 | また、C プロセッサが知りすぎているプラットフォームもあります。 | |
1732 | C++ スタイルの C<"//"> という「行末までのコメント」を知っている場合です。 | |
1733 | この場合、以下のような良くある Perl の構造で問題が起こり得ます: | |
1734 | ||
1735 | s/foo//; | |
1736 | ||
1737 | =begin original | |
1738 | ||
1739 | because after -P this will became illegal code | |
1740 | ||
1741 | =end original | |
1742 | ||
1743 | なぜなら -P 適用後以下のような不正なコードになるからです。 | |
1744 | ||
1745 | s/foo | |
1746 | ||
1747 | =begin original | |
1748 | ||
1749 | The workaround is to use some other quoting separator than C<"/">, | |
1750 | like for example C<"!">: | |
1751 | ||
1752 | =end original | |
1753 | ||
1754 | 回避策としては、クオート文字を C<"/"> 以外にする方法があります。 | |
1755 | 以下では C<"!"> にしています: | |
1756 | ||
1757 | s!foo!!; | |
1758 | ||
1759 | =item * | |
1760 | ||
1761 | =begin original | |
1762 | ||
1763 | It requires not only a working C preprocessor but also a working | |
1764 | F<sed>. If not on UNIX, you are probably out of luck on this. | |
1765 | ||
1766 | =end original | |
1767 | ||
1768 | これは C プリプロセッサだけでなく、F<sed> も動作する必要があります。 | |
1769 | UNIX でない場合、そのような幸運に恵まれないかもしれません。 | |
1770 | ||
1771 | =item * | |
1772 | ||
1773 | =begin original | |
1774 | ||
1775 | Script line numbers are not preserved. | |
1776 | ||
1777 | =end original | |
1778 | ||
1779 | スクリプトの行番号は保存されません。 | |
1780 | ||
1781 | =item * | |
1782 | ||
1783 | =begin original | |
1784 | ||
1785 | The C<-x> does not work with C<-P>. | |
1786 | ||
1787 | =end original | |
1788 | ||
1789 | C<-x> は C<-P> と同時には動作しません。 | |
1790 | ||
1791 | =back | |
1792 | ||
1838 | 1793 | =item B<-s> |
1839 | 1794 | X<-s> |
1840 | 1795 | |
1841 | 1796 | =begin original |
1842 | 1797 | |
1843 | 1798 | enables rudimentary switch parsing for switches on the command |
1844 | 1799 | line after the program name but before any filename arguments (or before |
1845 | 1800 | an argument of B<-->). Any switch found there is removed from @ARGV and sets the |
1846 | corresponding variable in the Perl program | |
1801 | corresponding variable in the Perl program. The following program | |
1847 | 1802 | prints "1" if the program is invoked with a B<-xyz> switch, and "abc" |
1848 | 1803 | if it is invoked with B<-xyz=abc>. |
1849 | 1804 | |
1850 | 1805 | =end original |
1851 | 1806 | |
1852 | 1807 | コマンドライン上のプログラム名の後から、ファイル名引数 |
1853 | 1808 | (または引数 B<-->) の前までのスイッチのための、原始的な解析を |
1854 | 1809 | 行なえるようにします。 |
1855 | 1810 | ここで見つかったスイッチは、@ARGV から取り除かれ、対応する Perl プログラムの |
1856 | ||
1811 | 変数に設定されます。 | |
1857 | 1812 | 以下のプログラムは、B<-xyz> というスイッチを付けて実行された時にだけ、 |
1858 | 1813 | "1" と表示し、B<-xyz=abc> と起動された時に "abc" と表示します。 |
1859 | 1814 | |
1860 | 1815 | #!/usr/bin/perl -s |
1861 | 1816 | if ($xyz) { print "$xyz\n" } |
1862 | 1817 | |
1863 | 1818 | =begin original |
1864 | 1819 | |
1865 | Do note that a switch like B<--help> creates the variable | |
1820 | Do note that a switch like B<--help> creates the variable ${-help}, which is not compliant | |
1866 | ||
1821 | with C<strict refs>. Also, when using this option on a script with | |
1867 | ||
1822 | warnings enabled you may get a lot of spurious "used only once" warnings. | |
1868 | warnings. For these reasons, use of B<-s> is discouraged. See L<Getopt::Long> | |
1869 | for much more flexible switch parsing. | |
1870 | 1823 | |
1871 | 1824 | =end original |
1872 | 1825 | |
1873 | B<--help> のようなスイッチは変数 | |
1826 | B<--help> のようなスイッチは変数 ${-help} を作成するので、C<strict refs> を | |
1874 | ||
1827 | 満たさないことに注意してください。 | |
1875 | 1828 | また、警告を有効にしたスクリプトでこのオプションを使うと、大量の |
1876 | 1829 | "used only once" という偽警告がでることになります。 |
1877 | これらの理由により、B<-s> の仕様は非推奨です。 | |
1878 | はるかに柔軟なオプションのパース方法については L<Getopt::Long> を | |
1879 | 参照してください。 | |
1880 | 1830 | |
1881 | 1831 | =item B<-S> |
1882 | 1832 | X<-S> |
1883 | 1833 | |
1884 | 1834 | =begin original |
1885 | 1835 | |
1886 | makes Perl use the | |
1836 | makes Perl use the PATH environment variable to search for the | |
1887 | program unless the name of the program contains | |
1837 | program (unless the name of the program contains directory separators). | |
1888 | 1838 | |
1889 | 1839 | =end original |
1890 | 1840 | |
1891 | プログラム | |
1841 | Perl がプログラムを探すときに環境変数 PATH を参照するようにします | |
1892 | ||
1842 | (プログラム名がディレクトリセパレータを含むときを除きます)。 | |
1893 | 1843 | |
1894 | 1844 | =begin original |
1895 | 1845 | |
1896 | 1846 | On some platforms, this also makes Perl append suffixes to the |
1897 | 1847 | filename while searching for it. For example, on Win32 platforms, |
1898 | 1848 | the ".bat" and ".cmd" suffixes are appended if a lookup for the |
1899 | 1849 | original name fails, and if the name does not already end in one |
1900 | of those suffixes. If your Perl was compiled with | |
1850 | of those suffixes. If your Perl was compiled with DEBUGGING turned | |
1901 | on, using the | |
1851 | on, using the -Dp switch to Perl shows how the search progresses. | |
1902 | progresses. | |
1903 | 1852 | |
1904 | 1853 | =end original |
1905 | 1854 | |
1906 | 1855 | プラットフォームによっては、Perl はファイルを探すときに拡張子を |
1907 | 1856 | 追加します。 |
1908 | 1857 | 例えば Win32 プラットフォームでは、元々のファイル名で検索が失敗した場合、 |
1909 | ".bat" と ".cmd" の拡張子が追加されます | |
1858 | ".bat" と ".cmd" の拡張子が追加されます。 | |
1910 | ついていない場合だけです。 | |
1859 | 但し既にそのような拡張子がついていない場合だけです。 | |
1911 | Perl が | |
1860 | Perl が DEBUGGING を有効にしてコンパイルされていた場合、-Dp スイッチを | |
1912 | L<-Dp|/-Dletters> スイッチを | |
1913 | 1861 | 使うことでどのように検索が行われているかを表示させることができます。 |
1914 | 1862 | |
1915 | 1863 | =begin original |
1916 | 1864 | |
1917 | Typically this is used to emulate | |
1865 | Typically this is used to emulate #! startup on platforms that don't | |
1918 | support | |
1866 | support #!. Its also convenient when debugging a script that uses #!, | |
1919 | 1867 | and is thus normally found by the shell's $PATH search mechanism. |
1920 | 1868 | |
1921 | 1869 | =end original |
1922 | 1870 | |
1923 | これは、 | |
1871 | これは、#! をサポートしていないプラットフォームで、#! による実行を | |
1924 | 1872 | エミュレートするために使います。 |
1925 | また、 | |
1873 | また、#! を使ったスクリプトで、通常はシェルの $PATH 検索メカニズムで | |
1926 | 1874 | 見つけられるようなスクリプトをデバッグするのにも便利です。 |
1927 | 1875 | |
1928 | 1876 | =begin original |
1929 | 1877 | |
1930 | 1878 | This example works on many platforms that have a shell compatible with |
1931 | 1879 | Bourne shell: |
1932 | 1880 | |
1933 | 1881 | =end original |
1934 | 1882 | |
1935 | 1883 | この例は Bourne shell 互換のシェルを持つ多くのプラットフォームで動きます: |
1936 | 1884 | |
1937 | 1885 | #!/usr/bin/perl |
1938 | 1886 | eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}' |
1939 | if | |
1887 | if $running_under_some_shell; | |
1940 | 1888 | |
1941 | 1889 | =begin original |
1942 | 1890 | |
1943 | 1891 | The system ignores the first line and feeds the program to F</bin/sh>, |
1944 | 1892 | which proceeds to try to execute the Perl program as a shell script. |
1945 | 1893 | The shell executes the second line as a normal shell command, and thus |
1946 | 1894 | starts up the Perl interpreter. On some systems $0 doesn't always |
1947 | contain the full pathname, so the | |
1895 | contain the full pathname, so the B<-S> tells Perl to search for the | |
1948 | 1896 | program if necessary. After Perl locates the program, it parses the |
1949 | lines and ignores them because the | |
1897 | lines and ignores them because the variable $running_under_some_shell | |
1950 | If the program will be interpreted by csh, you will need | |
1898 | is never true. If the program will be interpreted by csh, you will need | |
1951 | 1899 | to replace C<${1+"$@"}> with C<$*>, even though that doesn't understand |
1952 | embedded spaces (and such) in the argument list. To start up | |
1900 | embedded spaces (and such) in the argument list. To start up sh rather | |
1953 | than | |
1901 | than csh, some systems may have to replace the #! line with a line | |
1954 | 1902 | containing just a colon, which will be politely ignored by Perl. Other |
1955 | 1903 | systems can't control that, and need a totally devious construct that |
1956 | will work under any of | |
1904 | will work under any of B<csh>, B<sh>, or Perl, such as the following: | |
1957 | 1905 | |
1958 | 1906 | =end original |
1959 | 1907 | |
1960 | 1908 | システムは、最初の行を無視し、プログラムを F</bin/sh> に渡し、 |
1961 | 1909 | F</bin/sh> は Perl プログラムをシェルプログラムとして実行しようとします。 |
1962 | 1910 | シェルは 2 行目を通常のシェルコマンドとして実行し、Perl インタプリタを |
1963 | 1911 | 起動することになります。 |
1964 | 1912 | $0 にフルパス名が入っているとは限らないシステムもありますので、 |
1965 | ||
1913 | B<-S> が Perl に必要に応じてプログラムを探すように指示します。 | |
1966 | 1914 | Perl がプログラムを見つけると、これらの行の解析を始めますが、 |
1967 | ||
1915 | $running_under_some_shell が真になることがないため、 | |
1916 | 無視することになります。 | |
1968 | 1917 | プログラムが csh で解釈される場合には、たとえファイル名内に埋め込まれた |
1969 | 1918 | スペースなどを扱うことができなくても C<${1+"$@"}> を C<$*> で |
1970 | 1919 | 置き換える必要があるかもしれません。 |
1971 | ||
1920 | csh ではなく、sh を起動するように、いくつかのシステムでは、#! の行を | |
1972 | 1921 | Perl も無視することになっている、コロンだけの行で置き換える必要が |
1973 | 1922 | あるかもしれません。 |
1974 | そういった制御が効かないシステムでは、 | |
1923 | そういった制御が効かないシステムでは、B<csh> でも B<sh> でも | |
1975 | 1924 | Perl でも使える、回りくどい方法を使うことが必要です: |
1976 | 1925 | |
1977 | 1926 | eval '(exit $?0)' && eval 'exec perl -wS $0 ${1+"$@"}' |
1978 | 1927 | & eval 'exec /usr/bin/perl -wS $0 $argv:q' |
1979 | if | |
1928 | if $running_under_some_shell; | |
1980 | 1929 | |
1981 | 1930 | =begin original |
1982 | 1931 | |
1983 | If the filename supplied contains directory separators ( | |
1932 | If the filename supplied contains directory separators (i.e., is an | |
1984 | 1933 | absolute or relative pathname), and if that file is not found, |
1985 | 1934 | platforms that append file extensions will do so and try to look |
1986 | 1935 | for the file with those extensions added, one by one. |
1987 | 1936 | |
1988 | 1937 | =end original |
1989 | 1938 | |
1990 | 1939 | ファイル名にディレクトリセパレータが含まれていた場合 |
1991 | ( | |
1940 | (つまり絶対パスまたは相対パスだった場合)、そしてそのファイルが | |
1992 | 1941 | なかった場合、ファイル拡張子を追加するプラットフォームでは |
1993 | 1942 | ひとつずつ拡張子を追加して、ファイルを探します。 |
1994 | 1943 | |
1995 | 1944 | =begin original |
1996 | 1945 | |
1997 | 1946 | On DOS-like platforms, if the program does not contain directory |
1998 | 1947 | separators, it will first be searched for in the current directory |
1999 | 1948 | before being searched for on the PATH. On Unix platforms, the |
2000 | 1949 | program will be searched for strictly on the PATH. |
2001 | 1950 | |
2002 | 1951 | =end original |
2003 | 1952 | |
2004 | 1953 | DOS 風のプラットフォームでは、プログラムにディレクトリセパレータが |
2005 | 1954 | 含まれていなかった場合、PATH を探す前に最初にカレントディレクトリを |
2006 | 1955 | 探します。 |
2007 | 1956 | Unix プラットフォームでは、プログラムは厳密に PATH からのみ探されます。 |
2008 | 1957 | |
2009 | 1958 | =item B<-t> |
2010 | 1959 | X<-t> |
2011 | 1960 | |
2012 | 1961 | =begin original |
2013 | 1962 | |
2014 | Like | |
1963 | Like B<-T>, but taint checks will issue warnings rather than fatal | |
2015 | errors. These warnings can | |
1964 | errors. These warnings can be controlled normally with C<no warnings | |
2016 | 1965 | qw(taint)>. |
2017 | 1966 | |
2018 | 1967 | =end original |
2019 | 1968 | |
2020 | ||
1969 | B<-T> と同様ですが、汚染チェックは致命的エラーではなく警告を発生させます。 | |
2021 | 1970 | この警告は通常通り C<no warnings qw(taint)> で制御できます。 |
2022 | 1971 | |
2023 | 1972 | =begin original |
2024 | 1973 | |
2025 | B<N | |
1974 | B<NOTE: this is not a substitute for -T.> This is meant only to be | |
2026 | used | |
1975 | used as a temporary development aid while securing legacy code: | |
2027 | for real production code and for new secure code written from scratch | |
1976 | for real production code and for new secure code written from scratch | |
2028 | always use the real | |
1977 | always use the real B<-T>. | |
2029 | 1978 | |
2030 | 1979 | =end original |
2031 | 1980 | |
2032 | B<注意: これは | |
1981 | B<注意: これは -T の代用品ではありません。> | |
2033 | これは昔のコードを安全にするのを助けるために一時的に使用されるため | |
1982 | これは昔のコードを安全にするのを助けるために一時的に使用されるためだけの | |
2034 | ||
1983 | ものです: | |
2035 | 1984 | 本当の製品版コードと最初から書く安全なコードのためには常に本当の |
2036 | ||
1985 | B<-T> を使ってください。 | |
2037 | 1986 | |
2038 | =begin original | |
2039 | ||
2040 | This has no effect if your perl was built without taint support. | |
2041 | ||
2042 | =end original | |
2043 | ||
2044 | これは perl 汚染チェック対応なしでビルドされている場合は | |
2045 | 何の効果もありません。 | |
2046 | ||
2047 | 1987 | =item B<-T> |
2048 | 1988 | X<-T> |
2049 | 1989 | |
2050 | 1990 | =begin original |
2051 | 1991 | |
2052 | ||
1992 | forces "taint" checks to be turned on so you can test them. Ordinarily | |
2053 | 1993 | these checks are done only when running setuid or setgid. It's a |
2054 | 1994 | good idea to turn them on explicitly for programs that run on behalf |
2055 | 1995 | of someone else whom you might not necessarily trust, such as CGI |
2056 | 1996 | programs or any internet servers you might write in Perl. See |
2057 | 1997 | L<perlsec> for details. For security reasons, this option must be |
2058 | 1998 | seen by Perl quite early; usually this means it must appear early |
2059 | on the command line or in the | |
1999 | on the command line or in the #! line for systems which support | |
2060 | 2000 | that construct. |
2061 | 2001 | |
2062 | 2002 | =end original |
2063 | 2003 | |
2064 | 2004 | 「汚染」チェックをオンにして、テストできるようにします。 |
2065 | 2005 | 通常、このチェックは setuid や setgid のスクリプトを実行するときにだけ、 |
2066 | 2006 | 行なわれます。 |
2067 | 2007 | CGI プログラムやインターネットサーバーを Perl で書くときのように、 |
2068 | 2008 | 信用できるとは限らない人が動かすようなプログラムではこれを明示的に |
2069 | 2009 | 有効にするのはいい考えです。 |
2070 | 2010 | 詳細については L<perlsec> を参照してください。 |
2071 | 2011 | セキュリティ上の理由から、このオプションは Perl にかなり早く |
2072 | 渡さなければなりません | |
2012 | 渡さなければなりません。 | |
2073 | ||
2013 | これは通常コマンドラインの最初の方につけるか、#! 構造に対応する | |
2014 | システムではここに書くかです。 | |
2074 | 2015 | |
2075 | 2016 | =item B<-u> |
2076 | 2017 | X<-u> |
2077 | 2018 | |
2078 | 2019 | =begin original |
2079 | 2020 | |
2080 | This switch causes Perl to dump core after compiling your | |
2021 | This obsolete switch causes Perl to dump core after compiling your | |
2081 | 2022 | program. You can then in theory take this core dump and turn it |
2082 | into an executable file by using the | |
2023 | into an executable file by using the B<undump> program (not supplied). | |
2083 | 2024 | This speeds startup at the expense of some disk space (which you |
2084 | 2025 | can minimize by stripping the executable). (Still, a "hello world" |
2085 | 2026 | executable comes out to about 200K on my machine.) If you want to |
2086 | execute a portion of your program before dumping, use the | |
2027 | execute a portion of your program before dumping, use the dump() | |
2087 | ||
2028 | operator instead. Note: availability of B<undump> is platform | |
2088 | 2029 | specific and may not be available for a specific port of Perl. |
2089 | 2030 | |
2090 | 2031 | =end original |
2091 | 2032 | |
2092 | このスイッチはプログラムのコンパイル後、コアダンプを | |
2033 | この古いスイッチはプログラムのコンパイル後、コアダンプを | |
2093 | 2034 | 行なうようにします。 |
2094 | 2035 | 理論的には、このコアダンプを持ってきて(Perl の配布では提供されていませんが) |
2095 | ||
2036 | B<undump> プログラムを使って、実行ファイルに変換することができます。 | |
2096 | 2037 | これは多少ディスク容量を食いますが (実行ファイルを strip することで |
2097 | 2038 | 少しは減ります)、実行開始を速くすることができます。 |
2098 | 2039 | (減らしても、"hello world" の実行ファイルは、私のマシンで 200K 程に |
2099 | 2040 | なります。) |
2100 | 2041 | ダンプする前に部分的にプログラムを実行しておきたい場合には、 |
2101 | このスイッチの代わりに | |
2042 | このスイッチの代わりに dump() 演算子を使ってください。 | |
2102 | 注意: | |
2043 | 注意:B<undump> が実行できるのは特定の環境下ですし、 | |
2103 | 2044 | これが使えない移植バージョンの Perl もあるでしょう。 |
2104 | 2045 | |
2105 | 2046 | =item B<-U> |
2106 | 2047 | X<-U> |
2107 | 2048 | |
2108 | 2049 | =begin original |
2109 | 2050 | |
2110 | 2051 | allows Perl to do unsafe operations. Currently the only "unsafe" |
2111 | operations are attempting to unlink directories while running as | |
2052 | operations are attempting to unlink directories while running as | |
2112 | and running setuid programs with fatal taint checks turned | |
2053 | superuser, and running setuid programs with fatal taint checks turned | |
2113 | ||
2054 | into warnings. Note that the B<-w> switch (or the C<$^W> variable) | |
2114 | ||
2055 | must be used along with this option to actually I<generate> the | |
2056 | taint-check warnings. | |
2115 | 2057 | |
2116 | 2058 | =end original |
2117 | 2059 | |
2118 | 2060 | Perl に安全でない操作を許可します。 |
2119 | 現在のところ | |
2061 | 現在のところ、「安全でない」操作には、スーパーユーザとして実行中に | |
2120 | ||
2062 | ディレクトリを削除しようとすることと、致命的な汚染チェックを警告に替えて、 | |
2121 | ||
2063 | setuid プログラムを実行することです。 | |
2122 | ||
2064 | B<-w> スイッチ(あるいは C<$^W> 変数)は汚染チェックの警告が実際に | |
2123 | ||
2065 | I<生成される> ためにこのオプションと共に使われなければなりません。 | |
2124 | 2066 | |
2125 | 2067 | =item B<-v> |
2126 | 2068 | X<-v> |
2127 | 2069 | |
2128 | 2070 | =begin original |
2129 | 2071 | |
2130 | 2072 | prints the version and patchlevel of your perl executable. |
2131 | 2073 | |
2132 | 2074 | =end original |
2133 | 2075 | |
2134 | 2076 | Perl 実行ファイルのバージョンとパッチレベルを表示します。 |
2135 | 2077 | |
2136 | 2078 | =item B<-V> |
2137 | 2079 | X<-V> |
2138 | 2080 | |
2139 | 2081 | =begin original |
2140 | 2082 | |
2141 | 2083 | prints summary of the major perl configuration values and the current |
2142 | 2084 | values of @INC. |
2143 | 2085 | |
2144 | 2086 | =end original |
2145 | 2087 | |
2146 | 2088 | Perl の主な設定値と @INC の現在の値を表示します。 |
2147 | 2089 | |
2148 | 2090 | =item B<-V:>I<configvar> |
2149 | 2091 | |
2150 | 2092 | =begin original |
2151 | 2093 | |
2152 | 2094 | Prints to STDOUT the value of the named configuration variable(s), |
2153 | with multiples when your | |
2095 | with multiples when your configvar argument looks like a regex (has | |
2154 | 2096 | non-letters). For example: |
2155 | 2097 | |
2156 | 2098 | =end original |
2157 | 2099 | |
2158 | 2100 | 指定された設定変数の値を STDOUT に表示します; |
2159 | ||
2101 | configvar 引数が正規表現のように見えるもの(英字以外を含んでいる)の場合は | |
2160 | ||
2102 | 複数表示します。 | |
2161 | 2103 | 例えば: |
2162 | 2104 | |
2163 | 2105 | $ perl -V:libc |
2164 | 2106 | libc='/lib/libc-2.2.4.so'; |
2165 | 2107 | $ perl -V:lib. |
2166 | 2108 | libs='-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc'; |
2167 | 2109 | libc='/lib/libc-2.2.4.so'; |
2168 | 2110 | $ perl -V:lib.* |
2169 | 2111 | libpth='/usr/local/lib /lib /usr/lib'; |
2170 | 2112 | libs='-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc'; |
2171 | 2113 | lib_ext='.a'; |
2172 | 2114 | libc='/lib/libc-2.2.4.so'; |
2173 | 2115 | libperl='libperl.a'; |
2174 | 2116 | .... |
2175 | 2117 | |
2176 | 2118 | =begin original |
2177 | 2119 | |
2178 | 2120 | Additionally, extra colons can be used to control formatting. A |
2179 | trailing colon suppresses the linefeed and terminator | |
2121 | trailing colon suppresses the linefeed and terminator ';', allowing | |
2180 | 2122 | you to embed queries into shell commands. (mnemonic: PATH separator |
2181 | ||
2123 | ':'.) | |
2182 | 2124 | |
2183 | 2125 | =end original |
2184 | 2126 | |
2185 | 2127 | さらに、追加のコロンはフォーマットの制御に使います。 |
2186 | 末尾のコロンは改行と終端子 | |
2128 | 末尾のコロンは改行と終端子 ';' を抑制し、シェルコマンド中にクエリを | |
2187 | 2129 | 組み込めるようにします。 |
2188 | (記憶法: PATH セパレータ | |
2130 | (記憶法: PATH セパレータ ':'。) | |
2189 | 2131 | |
2190 | 2132 | $ echo "compression-vars: " `perl -V:z.*: ` " are here !" |
2191 | 2133 | compression-vars: zcat='' zip='zip' are here ! |
2192 | 2134 | |
2193 | 2135 | =begin original |
2194 | 2136 | |
2195 | A leading colon removes the | |
2137 | A leading colon removes the 'name=' part of the response, this allows | |
2196 | 2138 | you to map to the name you need. (mnemonic: empty label) |
2197 | 2139 | |
2198 | 2140 | =end original |
2199 | 2141 | |
2200 | 先頭のコロンはレスポンスの | |
2142 | 先頭のコロンはレスポンスの 'name=' の部分を削除し、必要な名前に | |
2201 | 2143 | マッピングできるようにします。 |
2202 | 2144 | (記憶法: 空ラベル) |
2203 | 2145 | |
2204 | 2146 | $ echo "goodvfork="`./perl -Ilib -V::usevfork` |
2205 | 2147 | goodvfork=false; |
2206 | 2148 | |
2207 | 2149 | =begin original |
2208 | 2150 | |
2209 | 2151 | Leading and trailing colons can be used together if you need |
2210 | 2152 | positional parameter values without the names. Note that in the case |
2211 | below, the | |
2153 | below, the PERL_API params are returned in alphabetical order. | |
2212 | 2154 | |
2213 | 2155 | =end original |
2214 | 2156 | |
2215 | 2157 | もし位置パラメータの値を名前なしで必要なら、先頭のコロンと末尾のコロンを |
2216 | 2158 | 両方使えます。 |
2217 | 以下の場合、 | |
2159 | 以下の場合、PERL_API パラメータはアルファベット順に返されることに | |
2218 | 2160 | 注意してください。 |
2219 | 2161 | |
2220 | 2162 | $ echo building_on `perl -V::osname: -V::PERL_API_.*:` now |
2221 | 2163 | building_on 'linux' '5' '1' '9' now |
2222 | 2164 | |
2223 | 2165 | =item B<-w> |
2224 | 2166 | X<-w> |
2225 | 2167 | |
2226 | 2168 | =begin original |
2227 | 2169 | |
2228 | 2170 | prints warnings about dubious constructs, such as variable names |
2229 | mentioned only once and scalar variables used | |
2171 | that are mentioned only once and scalar variables that are used | |
2230 | before being set | |
2172 | before being set, redefined subroutines, references to undefined | |
2231 | filehandles | |
2173 | filehandles or filehandles opened read-only that you are attempting | |
2232 | to write on | |
2174 | to write on, values used as a number that don't look like numbers, | |
2233 | using an array as though it were a scalar | |
2175 | using an array as though it were a scalar, if your subroutines | |
2234 | recurse more than 100 deep | |
2176 | recurse more than 100 deep, and innumerable other things. | |
2235 | 2177 | |
2236 | 2178 | =end original |
2237 | 2179 | |
2238 | 2180 | 1 度しか使われない変数名、設定される前に使われている変数、サブルーチンの |
2239 | 2181 | 再定義、未定義のファイルハンドルの参照や、読み込み専用でオープンした |
2240 | ファイルハンドルへの書き込み、数値に | |
2182 | ファイルハンドルへの書き込み、数値に見えない値を数値として使った場合、 | |
2241 | 2183 | 配列をスカラであるかのように使った場合、100 段階以上のサブルーティンの再帰、 |
2242 | 2184 | その他たくさんの疑わしい事に警告を出します。 |
2243 | 2185 | |
2244 | 2186 | =begin original |
2245 | 2187 | |
2246 | This switch really just enables the | |
2188 | This switch really just enables the internal C<$^W> variable. You | |
2247 | the lexically scoped C<use warnings> pragma is preferred. You | |
2248 | 2189 | can disable or promote into fatal errors specific warnings using |
2249 | 2190 | C<__WARN__> hooks, as described in L<perlvar> and L<perlfunc/warn>. |
2250 | See also L<perldiag> and L<perltrap>. A fine-grained warning | |
2191 | See also L<perldiag> and L<perltrap>. A new, fine-grained warning | |
2251 | 2192 | facility is also available if you want to manipulate entire classes |
2252 | of warnings; see L<warnings>. | |
2193 | of warnings; see L<warnings> or L<perllexwarn>. | |
2253 | 2194 | |
2254 | 2195 | =end original |
2255 | 2196 | |
2256 | このスイッチは実際には | |
2197 | このスイッチは実際には内部の C<$^W> 変数を有効にするだけです。 | |
2257 | ||
2198 | C<__WARN__> フックを使って特定の警告を無効にしたり致命的エラーに | |
2258 | ||
2199 | したりできます。 | |
2259 | ||
2200 | これについては L<perlvar> と L<perlfunc/warn> を参照して下さい。 | |
2260 | L<perldiag> と L<perltrap> も参照して | |
2201 | L<perldiag> と L<perltrap> も参照して下さい。 | |
2261 | もし警告のクラス全体を操作したいなら、粒度の細かい | |
2202 | もし警告のクラス全体を操作したいなら、新しく粒度の細かい | |
2262 | ||
2203 | 警告機能もあります。 | |
2204 | L<warnings> や L<perllexwarn> を参照して下さい。 | |
2263 | 2205 | |
2264 | 2206 | =item B<-W> |
2265 | 2207 | X<-W> |
2266 | 2208 | |
2267 | 2209 | =begin original |
2268 | 2210 | |
2269 | 2211 | Enables all warnings regardless of C<no warnings> or C<$^W>. |
2270 | See L<warn | |
2212 | See L<perllexwarn>. | |
2271 | 2213 | |
2272 | 2214 | =end original |
2273 | 2215 | |
2274 | 2216 | C<no warnings> や C<$^W> の設定に関わらず全ての警告を有効にします。 |
2275 | L<warn | |
2217 | L<perllexwarn> を参照して下さい。 | |
2276 | 2218 | |
2277 | 2219 | =item B<-X> |
2278 | 2220 | X<-X> |
2279 | 2221 | |
2280 | 2222 | =begin original |
2281 | 2223 | |
2282 | 2224 | Disables all warnings regardless of C<use warnings> or C<$^W>. |
2283 | See L<warn | |
2225 | See L<perllexwarn>. | |
2284 | 2226 | |
2285 | 2227 | =end original |
2286 | 2228 | |
2287 | 2229 | C<use warnings> や C<$^W> の設定に関わらず全ての警告を無効にします。 |
2288 | L<warn | |
2230 | L<perllexwarn> を参照して下さい。 | |
2289 | 2231 | |
2290 | =begin original | |
2291 | ||
2292 | Forbidden in C<L</PERL5OPT>>. | |
2293 | ||
2294 | =end original | |
2295 | ||
2296 | C<L</PERL5OPT>> では禁止されています。 | |
2297 | ||
2298 | 2232 | =item B<-x> |
2299 | 2233 | X<-x> |
2300 | 2234 | |
2301 | 2235 | =item B<-x>I<directory> |
2302 | 2236 | |
2303 | 2237 | =begin original |
2304 | 2238 | |
2305 | 2239 | tells Perl that the program is embedded in a larger chunk of unrelated |
2306 | text, such as in a mail message. Leading garbage will be | |
2240 | ASCII text, such as in a mail message. Leading garbage will be | |
2307 | discarded until the first line that starts with | |
2241 | discarded until the first line that starts with #! and contains the | |
2308 | 2242 | string "perl". Any meaningful switches on that line will be applied. |
2309 | 2243 | |
2310 | 2244 | =end original |
2311 | 2245 | |
2312 | メールのような大きな無関係のテキストのかたまりの中にプログラムが | |
2246 | メールのような大きな無関係のASCII テキストのかたまりの中にプログラムが | |
2313 | 2247 | 埋め込まれている事を Perl に伝えます。 |
2314 | 最初の | |
2248 | 最初の #! で始まり、"perl" という文字列を含む行までの、先行するゴミは | |
2315 | 2249 | 捨てられます。 |
2316 | 2250 | その行にある意味を持つスイッチは適用されます。 |
2317 | 2251 | |
2318 | 2252 | =begin original |
2319 | 2253 | |
2320 | 2254 | All references to line numbers by the program (warnings, errors, ...) |
2321 | will treat the | |
2255 | will treat the #! line as the first line. | |
2322 | Thus a warning on the 2nd line of the program | |
2256 | Thus a warning on the 2nd line of the program (which is on the 100th | |
2323 | line in the file will be reported as line 2, not as line 100. | |
2257 | line in the file) will be reported as line 2, and not as line 100. | |
2324 | This can be overridden by using the | |
2258 | This can be overridden by using the #line directive. | |
2325 | (See L<perlsyn/"Plain | |
2259 | (See L<perlsyn/"Plain-Old-Comments-(Not!)">) | |
2326 | 2260 | |
2327 | 2261 | =end original |
2328 | 2262 | |
2329 | プログラムによる行番号への全ての参照 (警告、エラー…) は | |
2263 | プログラムによる行番号への全ての参照 (警告、エラー…) は #! 行を | |
2330 | 2264 | 最初の行として扱います。 |
2331 | 2265 | 従って、プログラムの 2 番目の行 (ファイルとしては 100 行目) での警告は |
2332 | 2266 | 100 行目ではなく 2 行目として報告されます。 |
2333 | これは | |
2267 | これは #line 指示子を使って上書きできます。 | |
2334 | (L<perlsyn/"Plain | |
2268 | (L<perlsyn/"Plain-Old-Comments-(Not!)"> を参照してください。) | |
2335 | 2269 | |
2336 | 2270 | =begin original |
2337 | 2271 | |
2338 | 2272 | If a directory name is specified, Perl will switch to that directory |
2339 | 2273 | before running the program. The B<-x> switch controls only the |
2340 | 2274 | disposal of leading garbage. The program must be terminated with |
2341 | C<__END__> if there is trailing garbage to be ignored | |
2275 | C<__END__> if there is trailing garbage to be ignored (the program | |
2342 | can process any or all of the trailing garbage via the | |
2276 | can process any or all of the trailing garbage via the DATA filehandle | |
2343 | if desired. | |
2277 | if desired). | |
2344 | 2278 | |
2345 | 2279 | =end original |
2346 | 2280 | |
2347 | ||
2281 | directory が指定されると、Perl はプログラムの実行前に、そのディレクトリに | |
2348 | ||
2282 | 移ります。 | |
2349 | ||
2283 | C<-x> スイッチは先行するゴミの処分を制御するだけです。 | |
2350 | ||
2284 | プログラムの後に無視すべきゴミがある場合には、C<__END__> でプログラムを | |
2351 | 終了 | |
2285 | 終了する必要があります (その、後に続くゴミの一部または全部は、必要に応じて | |
2352 | ||
2286 | DATA ファイルハンドルを通して、そのプログラムで処理する事ができます)。 | |
2353 | 2287 | |
2354 | 2288 | =begin original |
2355 | 2289 | |
2356 | 2290 | The directory, if specified, must appear immediately following the B<-x> |
2357 | 2291 | with no intervening whitespace. |
2358 | 2292 | |
2359 | 2293 | =end original |
2360 | 2294 | |
2361 | 2295 | ディレクトリが指定される場合は、これは B<-x> の直後、空白なしに |
2362 | 2296 | 引き続かなければなりません。 |
2363 | 2297 | |
2364 | 2298 | =back |
2365 | 2299 | |
2366 | 2300 | =head1 ENVIRONMENT |
2367 | 2301 | X<perl, environment variables> |
2368 | 2302 | |
2369 | 2303 | (環境変数) |
2370 | 2304 | |
2371 | 2305 | =over 12 |
2372 | 2306 | |
2373 | 2307 | =item HOME |
2374 | 2308 | X<HOME> |
2375 | 2309 | |
2376 | 2310 | =begin original |
2377 | 2311 | |
2378 | Used if | |
2312 | Used if chdir has no argument. | |
2379 | 2313 | |
2380 | 2314 | =end original |
2381 | 2315 | |
2382 | ||
2316 | chdir の引数がないときに使われます。 | |
2383 | 2317 | |
2384 | 2318 | =item LOGDIR |
2385 | 2319 | X<LOGDIR> |
2386 | 2320 | |
2387 | 2321 | =begin original |
2388 | 2322 | |
2389 | Used if | |
2323 | Used if chdir has no argument and HOME is not set. | |
2390 | 2324 | |
2391 | 2325 | =end original |
2392 | 2326 | |
2393 | ||
2327 | chdir の引数がなく、HOME がセットされていないときに使われます。 | |
2394 | 2328 | |
2395 | 2329 | =item PATH |
2396 | 2330 | X<PATH> |
2397 | 2331 | |
2398 | 2332 | =begin original |
2399 | 2333 | |
2400 | Used in executing subprocesses, and in finding the program if | |
2334 | Used in executing subprocesses, and in finding the program if B<-S> is | |
2401 | 2335 | used. |
2402 | 2336 | |
2403 | 2337 | =end original |
2404 | 2338 | |
2405 | サブプロセスを実行するときと、 | |
2339 | サブプロセスを実行するときと、B<-S> が指定されたときにプログラムを | |
2406 | 2340 | 探すのに使われます。 |
2407 | 2341 | |
2408 | 2342 | =item PERL5LIB |
2409 | 2343 | X<PERL5LIB> |
2410 | 2344 | |
2411 | 2345 | =begin original |
2412 | 2346 | |
2413 | A list of directories in which to look for Perl library | |
2347 | A list of directories in which to look for Perl library | |
2414 | looking in the standard library | |
2348 | files before looking in the standard library and the current | |
2415 | Any architecture-specific | |
2349 | directory. Any architecture-specific directories under the specified | |
2416 | ||
2350 | locations are automatically included if they exist (this lookup | |
2417 | ||
2351 | being done at interpreter startup time.) | |
2418 | lookup done at interpreter startup time. In addition, any directories | |
2419 | matching the entries in C<$Config{inc_version_list}> are added. | |
2420 | (These typically would be for older compatible perl versions installed | |
2421 | in the same directory tree.) | |
2422 | 2352 | |
2423 | 2353 | =end original |
2424 | 2354 | |
2425 | Perl のライブラリファイルを探すときに標準ライブラリ | |
2355 | Perl のライブラリファイルを探すときに標準ライブラリディレクトリと | |
2426 | 探す前に探すディレクトリのリストです。 | |
2356 | カレントディレクトリを探す前に探すディレクトリのリストです。 | |
2427 | 特定の場所における | |
2357 | 特定の場所におけるアーキテクチャ依存のディレクトリは、もしあれば自動的に | |
2428 | ||
2358 | 追加されます(この検索はインタプリタ起動時に行われます)。 | |
2429 | 追加されます; この検索はインタプリタ起動時に行われます。 | |
2430 | さらに、C<$Config{inc_version_list}> のエントリにマッチングするディレクトリが | |
2431 | 追加されます。 | |
2432 | (これらは典型的には同じディレクトリツリーにより古い互換性のある perl が | |
2433 | インストールされている場合のためのものです。) | |
2434 | 2359 | |
2435 | 2360 | =begin original |
2436 | 2361 | |
2437 | If PERL5LIB is not defined, | |
2362 | If PERL5LIB is not defined, PERLLIB is used. Directories are separated | |
2438 | (like in PATH) by a colon on | |
2363 | (like in PATH) by a colon on unixish platforms and by a semicolon on | |
2439 | 2364 | Windows (the proper path separator being given by the command C<perl |
2440 | -V: | |
2365 | -V:path_sep>). | |
2441 | 2366 | |
2442 | 2367 | =end original |
2443 | 2368 | |
2444 | PERL5LIB が定義されていなければ、 | |
2369 | PERL5LIB が定義されていなければ、PERLLIB が使われます。 | |
2445 | ディレクトリは(PATH と同様に) | |
2370 | ディレクトリは(PATH と同様に)unix 風のプラットフォームではコロンで区切られ、 | |
2446 | 2371 | Windows ではセミコロンで区切られます(適切なパス区切り文字は |
2447 | 2372 | C<perl -V:path_sep> コマンドでわかります)。 |
2448 | 2373 | |
2449 | 2374 | =begin original |
2450 | 2375 | |
2451 | When running taint checks | |
2376 | When running taint checks (either because the program was running setuid | |
2452 | setgid, or the | |
2377 | or setgid, or the B<-T> or B<-t> switch was specified), neither variable | |
2453 | ||
2378 | is used. The program should instead say: | |
2454 | 2379 | |
2455 | 2380 | =end original |
2456 | 2381 | |
2457 | プログラムが setuid または setgid で実行されているか、 | |
2382 | (プログラムが setuid または setgid で実行されているか、B<-T> か B<-t> の | |
2458 | スイッチが指定されて | |
2383 | スイッチが指定されて)汚染チェック付きで動作している場合、どちらの環境変数も | |
2459 | ||
2384 | 使われません。 | |
2460 | 2385 | 代わりにプログラム中で以下のようにするべきです: |
2461 | 2386 | |
2462 | 2387 | use lib "/my/directory"; |
2463 | 2388 | |
2464 | 2389 | =item PERL5OPT |
2465 | 2390 | X<PERL5OPT> |
2466 | 2391 | |
2467 | 2392 | =begin original |
2468 | 2393 | |
2469 | Command-line options (switches). Switches in this variable are t | |
2394 | Command-line options (switches). Switches in this variable are taken | |
2470 | as if they were on every Perl command line. Only the B<-[CDIM | |
2395 | as if they were on every Perl command line. Only the B<-[CDIMUdmtw]> | |
2471 | switches are allowed. When running taint checks ( | |
2396 | switches are allowed. When running taint checks (because the program | |
2472 | ||
2397 | was running setuid or setgid, or the B<-T> switch was used), this | |
2473 | ||
2398 | variable is ignored. If PERL5OPT begins with B<-T>, tainting will be | |
2474 | ||
2399 | enabled, and any subsequent options ignored. | |
2475 | PERL5OPT begins with B<-t>, tainting will be enabled, a writable dot | |
2476 | removed from @INC, and subsequent options honored. | |
2477 | 2400 | |
2478 | 2401 | =end original |
2479 | 2402 | |
2480 | 2403 | コマンドラインオプション(スイッチ)です。 |
2481 | 2404 | この変数のスイッチは全ての Perl コマンドラインで指定されたかのように |
2482 | 2405 | 扱われます。 |
2483 | B<-[CDIM | |
2406 | B<-[CDIMUdmtw]> オプションのみが有効です。 | |
2484 | (プログラムが setuid または setgid で実行されているか、 | |
2407 | (プログラムが setuid または setgid で実行されているか、B<-T> スイッチが | |
2485 | ||
2408 | 指定されて)汚染チェック付きで動作している場合、この変数は無視されます。 | |
2486 | ||
2409 | PERL5OPT が B<-T> で始まっている場合、汚染チェックが有効となり、残りの | |
2487 | PERL5OPT が B<-T> で始まっている場合、汚染チェックが有効となり、引き続く | |
2488 | 2410 | オプションは無視されます。 |
2489 | PERL5OPT が B<-t> で始まっている場合、汚染チェックが有効となり、 | |
2490 | 書き込み可能なドットは @INC から削除され、引き続くオプションも有効に | |
2491 | なります。 | |
2492 | 2411 | |
2493 | 2412 | =item PERLIO |
2494 | 2413 | X<PERLIO> |
2495 | 2414 | |
2496 | 2415 | =begin original |
2497 | 2416 | |
2498 | 2417 | A space (or colon) separated list of PerlIO layers. If perl is built |
2499 | to use PerlIO system for IO (the default) these layers | |
2418 | to use PerlIO system for IO (the default) these layers effect perl's IO. | |
2500 | 2419 | |
2501 | 2420 | =end original |
2502 | 2421 | |
2503 | 2422 | 空白(またはコロン)で区切られた PerlIO 層のリストです。 |
2504 | 2423 | perl が IO に PerlIO システムを使うようにコンパイルされている場合 |
2505 | 2424 | (これがデフォルトです)、これらの層が perl の IO に影響を与えます。 |
2506 | 2425 | |
2507 | 2426 | =begin original |
2508 | 2427 | |
2509 | It is conventional to start layer names with a colon | |
2428 | It is conventional to start layer names with a colon e.g. C<:perlio> to | |
2510 | emphasi | |
2429 | emphasise their similarity to variable "attributes". But the code that parses | |
2511 | layer specification strings | |
2430 | layer specification strings (which is also used to decode the PERLIO | |
2512 | environment variable | |
2431 | environment variable) treats the colon as a separator. | |
2513 | 2432 | |
2514 | 2433 | =end original |
2515 | 2434 | |
2516 | 層名を | |
2435 | 変数"属性"との類似性を強調するために層名を C<:perlio> のようにコロンで | |
2517 | ||
2436 | 始める慣習があります。 | |
2518 | しかし層 | |
2437 | しかしプログラムは層を定義する文字列のパースする | |
2519 | 使われます) | |
2438 | (PERLIO 環境変数のデコードにも使われます)ときにコロンをセパレータとして | |
2439 | 扱います。 | |
2520 | 2440 | |
2521 | 2441 | =begin original |
2522 | 2442 | |
2523 | 2443 | An unset or empty PERLIO is equivalent to the default set of layers for |
2524 | your platform | |
2444 | your platform, for example C<:unix:perlio> on UNIX-like systems | |
2525 | 2445 | and C<:unix:crlf> on Windows and other DOS-like systems. |
2526 | 2446 | |
2527 | 2447 | =end original |
2528 | 2448 | |
2529 | 2449 | PERLIO をセットしない、または空文字列をセットすると、プラットフォームの |
2530 | 2450 | デフォルトの層の組み合わせと等価です; |
2531 | 例えば、U | |
2451 | 例えば、UNIX 風のシステムでは C<:unix:perlio> で、Windows やその他の | |
2532 | 2452 | DOS 風のシステムは C<:unix:crlf> です。 |
2533 | 2453 | |
2534 | 2454 | =begin original |
2535 | 2455 | |
2536 | The list becomes the default for I<all> | |
2456 | The list becomes the default for I<all> perl's IO. Consequently only built-in | |
2537 | layers can appear in this list, as external layers (such as | |
2457 | layers can appear in this list, as external layers (such as :encoding()) need | |
2538 | IO in order to load them! | |
2458 | IO in order to load them!. See L<"open pragma"|open> for how to add external | |
2539 | 2459 | encodings as defaults. |
2540 | 2460 | |
2541 | 2461 | =end original |
2542 | 2462 | |
2543 | このリストは I<全ての> | |
2463 | このリストは I<全ての> perl の IO のデフォルトとなります。 | |
2544 | 従って組み込みの層のみがこのリストに記述可能です | |
2464 | 従って組み込みの層のみがこのリストに記述可能です。 | |
2545 | ( | |
2465 | なぜなら(:encoding() のような)外部読み込みの層はロードするために | |
2546 | IO が必要だからです | |
2466 | IO が必要だからです。 | |
2547 | 2467 | デフォルトとして外部エンコーディングを追加する方法については |
2548 | 2468 | L<"open pragma"|open> を参照してください。 |
2549 | 2469 | |
2550 | 2470 | =begin original |
2551 | 2471 | |
2552 | ||
2472 | The layers that it makes sense to include in the PERLIO environment | |
2553 | variable are briefly summari | |
2473 | variable are briefly summarised below. For more details see L<PerlIO>. | |
2554 | 2474 | |
2555 | 2475 | =end original |
2556 | 2476 | |
2557 | 2477 | PERLIO 環境変数に加えることが妥当な層の簡単な一覧を以下に示します。 |
2558 | 2478 | 詳細については L<PerlIO> を参照してください。 |
2559 | 2479 | |
2560 | 2480 | =over 8 |
2561 | 2481 | |
2482 | =item :bytes | |
2483 | X<:bytes> | |
2484 | ||
2485 | =begin original | |
2486 | ||
2487 | A pseudolayer that turns I<off> the C<:utf8> flag for the layer below. | |
2488 | Unlikely to be useful on its own in the global PERLIO environment variable. | |
2489 | You 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 | ||
2562 | 2498 | =item :crlf |
2563 | 2499 | X<:crlf> |
2564 | 2500 | |
2565 | 2501 | =begin original |
2566 | 2502 | |
2567 | A layer which does CRLF to | |
2503 | A 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. | |
2569 | ||
2505 | (It currently does I<not> mimic MS-DOS as far as treating of Control-Z | |
2506 | as being an end-of-file marker.) | |
2570 | 2507 | |
2571 | 2508 | =end original |
2572 | 2509 | |
2573 | "テキスト"と"バイナリ"ファイルを識別する CRLF から | |
2510 | "テキスト"と"バイナリ"ファイルを識別する CRLF から "\n" への変換を | |
2574 | MS-DOS 及び似たようなオペレーティングシステムの方式で行 | |
2511 | MS-DOS 及び似たようなオペレーティングシステムの方式で行う層です。 | |
2575 | ||
2512 | (現在のところ Control-Z をファイルの終わりと見なすところまで MS-DOS を | |
2513 | まねてはいません。) | |
2576 | 2514 | |
2515 | =item :mmap | |
2516 | X<:mmap> | |
2517 | ||
2518 | =begin original | |
2519 | ||
2520 | A layer which implements "reading" of files by using C<mmap()> to | |
2521 | make (whole) file appear in the process's address space, and then | |
2522 | using that as PerlIO's "buffer". | |
2523 | ||
2524 | =end original | |
2525 | ||
2526 | ファイルの"読み込み"に C<mmap()> を使ってファイル(全体)をプロセスの | |
2527 | アドレス空間に割り当て、それを PerlIO の"バッファ"として使うための層です。 | |
2528 | ||
2577 | 2529 | =item :perlio |
2578 | 2530 | X<:perlio> |
2579 | 2531 | |
2580 | 2532 | =begin original |
2581 | 2533 | |
2582 | This is a re-implementation of stdio-like buffering written as a | |
2534 | This is a re-implementation of "stdio-like" buffering written as a | |
2583 | PerlIO layer. As such it will call whatever layer is below it for | |
2535 | PerlIO "layer". As such it will call whatever layer is below it for | |
2584 | its operations | |
2536 | its operations (typically C<:unix>). | |
2585 | 2537 | |
2586 | 2538 | =end original |
2587 | 2539 | |
2588 | これは | |
2540 | これは"stdio風"のバッファリングを PerlIO "層" として再実装したものです。 | |
2589 | 2541 | 従ってどのような層からも操作時に呼び出されます(典型的には C<:unix>)。 |
2590 | 2542 | |
2543 | =item :pop | |
2544 | X<:pop> | |
2545 | ||
2546 | =begin original | |
2547 | ||
2548 | An experimental pseudolayer that removes the topmost layer. | |
2549 | Use with the same care as is reserved for nitroglycerin. | |
2550 | ||
2551 | =end original | |
2552 | ||
2553 | 先頭の層を除去するための実験的な擬似層です。 | |
2554 | ニトログリセリンに対するのと同様の慎重さを持って使ってください。 | |
2555 | ||
2556 | =item :raw | |
2557 | X<:raw> | |
2558 | ||
2559 | =begin original | |
2560 | ||
2561 | A pseudolayer that manipulates other layers. Applying the C<:raw> | |
2562 | layer is equivalent to calling C<binmode($fh)>. It makes the stream | |
2563 | pass each byte as-is without any translation. In particular CRLF | |
2564 | translation, 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 | ||
2575 | Unlike in the earlier versions of Perl C<:raw> is I<not> | |
2576 | just the inverse of C<:crlf> - other layers which would affect the | |
2577 | binary nature of the stream are also removed or disabled. | |
2578 | ||
2579 | =end original | |
2580 | ||
2581 | 昔のバージョンの Perl と異なり、C<:raw> は C<:crlf> の逆 | |
2582 | I<ではありません> - ストリームのバイナリの性質に影響を与える | |
2583 | その他の層も除去されるか無効になります。 | |
2584 | ||
2591 | 2585 | =item :stdio |
2592 | 2586 | X<:stdio> |
2593 | 2587 | |
2594 | 2588 | =begin original |
2595 | 2589 | |
2596 | This layer provides | |
2590 | This layer provides PerlIO interface by wrapping system's ANSI C "stdio" | |
2597 | 2591 | library calls. The layer provides both buffering and IO. |
2598 | Note that | |
2592 | Note that C<:stdio> layer does I<not> do CRLF translation even if that | |
2599 | is | |
2593 | is platforms normal behaviour. You will need a C<:crlf> layer above it | |
2600 | 2594 | to do that. |
2601 | 2595 | |
2602 | 2596 | =end original |
2603 | 2597 | |
2604 | 2598 | この層はシステムの ANSI C "stdio" ライブラリコールをラップした |
2605 | 2599 | PerlIO インターフェースを提供します。 |
2606 | 2600 | この層はバッファリングと IO の両方を提供します。 |
2607 | C<:stdio> 層は CRLF 変換を I<行わない> ことに注意してください | |
2601 | C<:stdio> 層は CRLF 変換を I<行わない> ことに注意してください。 | |
2608 | プラットフォームの通常の振る舞いであっても、です。 | |
2602 | たとえそれがプラットフォームの通常の振る舞いであっても、です。 | |
2609 | 2603 | これを行うためには C<:crlf> 層が必要です。 |
2610 | 2604 | |
2611 | 2605 | =item :unix |
2612 | 2606 | X<:unix> |
2613 | 2607 | |
2614 | 2608 | =begin original |
2615 | 2609 | |
2616 | Low | |
2610 | Low level layer which calls C<read>, C<write> and C<lseek> etc. | |
2617 | 2611 | |
2618 | 2612 | =end original |
2619 | 2613 | |
2620 | 2614 | C<read>, C<write>, C<lseek> などを呼び出す低レベル層です。 |
2621 | 2615 | |
2616 | =item :utf8 | |
2617 | X<:utf8> | |
2618 | ||
2619 | =begin original | |
2620 | ||
2621 | A pseudolayer that turns on a flag on the layer below to tell perl | |
2622 | that output should be in utf8 and that input should be regarded as | |
2623 | already in valid utf8 form. It does not check for validity and as such | |
2624 | should be handled with caution for input. Generally C<:encoding(utf8)> is | |
2625 | the 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 | |
2636 | X<:win32> | |
2637 | ||
2638 | =begin original | |
2639 | ||
2640 | On Win32 platforms this I<experimental> layer uses native "handle" IO | |
2641 | rather than unix-like numeric file descriptor layer. Known to be | |
2642 | buggy in this release. | |
2643 | ||
2644 | =end original | |
2645 | ||
2646 | Win32 プラットフォームにおいて、この I<実験的> 層は unix 風の数値の | |
2647 | ファイル記述子層の代わりにネイティブな "ハンドル" IO を使用します。 | |
2648 | このリリースではバグっぽいことがわかっています。 | |
2649 | ||
2622 | 2650 | =back |
2623 | 2651 | |
2624 | 2652 | =begin original |
2625 | 2653 | |
2626 | ||
2654 | On all platforms the default set of layers should give acceptable results. | |
2627 | 2655 | |
2628 | 2656 | =end original |
2629 | 2657 | |
2630 | 2658 | 全てのプラットフォームでデフォルトの層の組み合わせは納得できる結果に |
2631 | 2659 | なっているはずです。 |
2632 | 2660 | |
2633 | 2661 | =begin original |
2634 | 2662 | |
2635 | For U | |
2663 | For UNIX platforms that will equivalent of "unix perlio" or "stdio". | |
2636 | Configure is set | |
2664 | Configure is setup to prefer "stdio" implementation if system's library | |
2637 | provides for fast access to the buffer | |
2665 | provides for fast access to the buffer, otherwise it uses the "unix perlio" | |
2638 | ||
2666 | implementation. | |
2639 | 2667 | |
2640 | 2668 | =end original |
2641 | 2669 | |
2642 | U | |
2670 | UNIX プラットフォームではこれは "unix perlio" または "stdio" と等価です。 | |
2643 | ||
2671 | configure スクリプトはシステムのライブラリがバッファへの高速アクセス方法を | |
2644 | 提供する場合 | |
2672 | 提供する場合は"stdio"実装を使うよう設定し、そうでなければ"unix perlio" | |
2645 | ||
2673 | 実装を使います。 | |
2646 | ":unix:perlio" 実装を使います。 | |
2647 | 2674 | |
2648 | 2675 | =begin original |
2649 | 2676 | |
2650 | On Win32 the default in this release | |
2677 | On Win32 the default in this release is "unix crlf". Win32's "stdio" | |
2651 | has a number of bugs/mis-features for | |
2678 | has a number of bugs/mis-features for perl IO which are somewhat | |
2652 | ||
2679 | C compiler vendor/version dependent. Using our own C<crlf> layer as | |
2653 | 2680 | the buffer avoids those issues and makes things more uniform. |
2681 | The C<crlf> layer provides CRLF to/from "\n" conversion as well as | |
2682 | buffering. | |
2654 | 2683 | |
2655 | 2684 | =end original |
2656 | 2685 | |
2657 | ||
2686 | Win32 ではデフォルトは"unix crlf"です。 | |
2658 | Win32 の" | |
2687 | Win32 の"stdio" は perl IO にとって、C コンパイラのベンダー/バージョン依存の | |
2659 | 2688 | 大量のバグ/仕様漏れがあります。 |
2660 | バッファとして自身の C< | |
2689 | バッファとして自身の C<crlf> 層を使うことでこれらの問題を回避し、 | |
2661 | 2690 | 物事をより一貫したものにします。 |
2691 | C<crlf> 層はバッファリング時に CRLF と "\n" の変換を行います。 | |
2662 | 2692 | |
2663 | 2693 | =begin original |
2664 | 2694 | |
2665 | This release | |
2695 | This release uses C<unix> as the bottom layer on Win32 and so still uses C | |
2666 | ||
2696 | compiler's numeric file descriptor routines. There is an experimental native | |
2697 | C<win32> layer which is expected to be enhanced and should eventually be | |
2698 | the default under Win32. | |
2667 | 2699 | |
2668 | 2700 | =end original |
2669 | 2701 | |
2670 | このリリース | |
2702 | このリリースでは Win32 での基底層として C<unix> を使うことで、未だに | |
2671 | 2703 | C コンパイラの数値のファイル記述子ルーチンを使います。 |
2704 | 拡張を予定されている実験的なネイティブの C<win32> 層があり、最終的には | |
2705 | これが Win32 でのデフォルトとなる予定です。 | |
2672 | 2706 | |
2673 | 2707 | =begin original |
2674 | 2708 | |
2675 | The PERLIO environment variable is completely ignored when | |
2709 | The PERLIO environment variable is completely ignored when perl | |
2676 | 2710 | is run in taint mode. |
2677 | 2711 | |
2678 | 2712 | =end original |
2679 | 2713 | |
2680 | PERLIO 環境変数は、 | |
2714 | PERLIO 環境変数は、perl が汚染モードで実行されるときには完全に無視されます。 | |
2681 | 2715 | |
2682 | 2716 | =item PERLIO_DEBUG |
2683 | 2717 | X<PERLIO_DEBUG> |
2684 | 2718 | |
2685 | 2719 | =begin original |
2686 | 2720 | |
2687 | If set to the name of a file or device | |
2721 | If set to the name of a file or device then certain operations of PerlIO | |
2688 | ||
2722 | sub-system will be logged to that file (opened as append). Typical uses | |
2689 | ||
2723 | are UNIX: | |
2690 | than going to stderr, which is the default. The file is opened in append | |
2691 | mode. Typical uses are in Unix: | |
2692 | 2724 | |
2693 | 2725 | =end original |
2694 | 2726 | |
2695 | Perl が L<-Di|/-Dletters> コマンドラインオプション付きで実行されているときに、 | |
2696 | 2727 | ファイルまたはデバイスの名前をセットすると、PerlIO サブシステムのいくつかの |
2697 | 操作 | |
2728 | 操作がそのファイルに(追記モードで)記録されます。 | |
2698 | ||
2729 | UNIX での典型的な使い方は以下の通りです: | |
2699 | ファイルは追記モードで記録されます。 | |
2700 | Unix での典型的な使い方は以下の通りです: | |
2701 | 2730 | |
2702 | | |
2731 | PERLIO_DEBUG=/dev/tty perl script ... | |
2703 | 2732 | |
2704 | 2733 | =begin original |
2705 | 2734 | |
2706 | and | |
2735 | and Win32 approximate equivalent: | |
2707 | 2736 | |
2708 | 2737 | =end original |
2709 | 2738 | |
2710 | 2739 | Win32 では以下がほぼ等価です: |
2711 | 2740 | |
2712 | | |
2741 | set PERLIO_DEBUG=CON | |
2713 | perl | |
2742 | perl script ... | |
2714 | 2743 | |
2715 | 2744 | =begin original |
2716 | 2745 | |
2717 | This functionality is disabled for setuid scripts | |
2746 | This functionality is disabled for setuid scripts and for scripts run | |
2718 | with | |
2747 | with B<-T>. | |
2719 | support. | |
2720 | 2748 | |
2721 | 2749 | =end original |
2722 | 2750 | |
2723 | この機能は、setuid されたスクリプトや | |
2751 | この機能は、setuid されたスクリプトや B<-T> で実行されているスクリプトでは | |
2724 | あるいは C<-DDEBUGGING> 対応なしでビルドされた Perl で実行された場合は | |
2725 | 2752 | 無効になります。 |
2726 | 2753 | |
2727 | 2754 | =item PERLLIB |
2728 | 2755 | X<PERLLIB> |
2729 | 2756 | |
2730 | 2757 | =begin original |
2731 | 2758 | |
2732 | 2759 | A list of directories in which to look for Perl library |
2733 | files before looking in the standard library. | |
2760 | files before looking in the standard library and the current directory. | |
2734 | If | |
2761 | If PERL5LIB is defined, PERLLIB is not used. | |
2735 | 2762 | |
2736 | 2763 | =end original |
2737 | 2764 | |
2738 | Perl | |
2765 | Perl ライブラリを探すのに標準ライブラリとカレントディレクトリの前に | |
2739 | ||
2766 | 検索するディレクトリのリストです。 | |
2740 | ||
2767 | PERL5LIB が定義されていると、PERLLIB は使われません。 | |
2741 | 2768 | |
2742 | 2769 | =begin original |
2743 | 2770 | |
2744 | The PERLLIB environment variable is completely ignored when | |
2771 | The PERLLIB environment variable is completely ignored when perl | |
2745 | 2772 | is run in taint mode. |
2746 | 2773 | |
2747 | 2774 | =end original |
2748 | 2775 | |
2749 | PERLLIB 環境変数は、 | |
2776 | PERLLIB 環境変数は、perl が汚染モードで実行されるときには完全に | |
2750 | 2777 | 無視されます。 |
2751 | 2778 | |
2752 | 2779 | =item PERL5DB |
2753 | 2780 | X<PERL5DB> |
2754 | 2781 | |
2755 | 2782 | =begin original |
2756 | 2783 | |
2757 | 2784 | The command used to load the debugger code. The default is: |
2758 | 2785 | |
2759 | 2786 | =end original |
2760 | 2787 | |
2761 | 2788 | デバッガコードを読み込むのに使われるコマンドです。 |
2762 | 2789 | デフォルトは以下の通り: |
2763 | 2790 | |
2764 | BEGIN { require | |
2791 | BEGIN { require 'perl5db.pl' } | |
2765 | 2792 | |
2766 | 2793 | =begin original |
2767 | 2794 | |
2768 | The PERL5DB environment variable | |
2795 | The PERL5DB environment variable only used when perl is started with | |
2769 | a bare | |
2796 | a bare B<-d> switch. | |
2770 | 2797 | |
2771 | 2798 | =end original |
2772 | 2799 | |
2773 | PERL5DB 環境変数は | |
2800 | PERL5DB 環境変数は perl が裸の B<-d> スイッチで開始されたときにのみ | |
2774 | 2801 | 使われます。 |
2775 | 2802 | |
2776 | 2803 | =item PERL5DB_THREADED |
2777 | 2804 | X<PERL5DB_THREADED> |
2778 | 2805 | |
2779 | 2806 | =begin original |
2780 | 2807 | |
2781 | 2808 | If set to a true value, indicates to the debugger that the code being |
2782 | 2809 | debugged uses threads. |
2783 | 2810 | |
2784 | 2811 | =end original |
2785 | 2812 | |
2786 | 2813 | 真の値にセットされると、デバッグするコードがスレッドを使うことをデバッガに |
2787 | 2814 | 示します。 |
2788 | 2815 | |
2789 | 2816 | =item PERL5SHELL (specific to the Win32 port) |
2790 | 2817 | X<PERL5SHELL> |
2791 | 2818 | |
2792 | 2819 | =begin original |
2793 | 2820 | |
2794 | ||
2821 | May be set to an alternative shell that perl must use internally for | |
2795 | ||
2822 | executing "backtick" commands or system(). Default is C<cmd.exe /x/d/c> | |
2796 | ||
2823 | on WindowsNT and C<command.com /c> on Windows95. The value is considered | |
2797 | ||
2824 | to be space-separated. Precede any character that needs to be protected | |
2798 | ||
2825 | (like a space or backslash) with a backslash. | |
2799 | 2826 | |
2800 | 2827 | =end original |
2801 | 2828 | |
2802 | Win32 版だけのもので、 | |
2803 | 2829 | "バッククォート" コマンドや system() を実行するために Perl が内部的に |
2804 | 2830 | 使わなければならない代替シェルを指定します。 |
2805 | 2831 | デフォルトは WindowsNT では C<cmd.exe /x/d/c>、Windows95 では |
2806 | 2832 | C<command.com /c> です。 |
2807 | 2833 | 値はスペース区切りと考えられます。 |
2808 | 空白やバックスラッシュのような | |
2834 | (空白やバックスラッシュのような) 保護する必要がある文字の前には | |
2809 | 2835 | バックスラッシュがつけられます。 |
2810 | 2836 | |
2811 | 2837 | =begin original |
2812 | 2838 | |
2813 | 2839 | Note that Perl doesn't use COMSPEC for this purpose because |
2814 | 2840 | COMSPEC has a high degree of variability among users, leading to |
2815 | portability concerns. Besides, | |
2841 | portability concerns. Besides, perl can use a shell that may not be | |
2816 | 2842 | fit for interactive use, and setting COMSPEC to such a shell may |
2817 | 2843 | interfere with the proper functioning of other programs (which usually |
2818 | 2844 | look in COMSPEC to find a shell fit for interactive use). |
2819 | 2845 | |
2820 | 2846 | =end original |
2821 | 2847 | |
2822 | 2848 | COMSPEC の値はユーザーによってかなり様々で、移植性の問題を引き起こすので、 |
2823 | 2849 | Perl はこの目的に COMSPEC は使わないことに注意してください。 |
2824 | 2850 | さらに、Perl は対話的な用途には向かないシェルも利用できますが、 |
2825 | 2851 | COMSPEC にそのようなシェルを指定すると他のプログラム |
2826 | 2852 | (普通は対話的な用途に適したシェルを探すのに COMSPEC を使います)の適切な |
2827 | 2853 | 利用を邪魔するかもしれません。 |
2828 | 2854 | |
2829 | 2855 | =begin original |
2830 | 2856 | |
2831 | 2857 | Before Perl 5.10.0 and 5.8.8, PERL5SHELL was not taint checked |
2832 | 2858 | when running external commands. It is recommended that |
2833 | 2859 | you explicitly set (or delete) C<$ENV{PERL5SHELL}> when running |
2834 | 2860 | in taint mode under Windows. |
2835 | 2861 | |
2836 | 2862 | =end original |
2837 | 2863 | |
2838 | 2864 | Perl 5.10.0 と 5.8.8 以前では、PERL5SHELL は外部コマンドを実行するときに |
2839 | 2865 | 汚染チェックされませんでした。 |
2840 | 2866 | Windows 上で汚染モードで実行するときには、明示的に C<$ENV{PERL5SHELL}> を |
2841 | 2867 | 設定(または削除)することを勧めます。 |
2842 | 2868 | |
2843 | 2869 | =item PERL_ALLOW_NON_IFS_LSP (specific to the Win32 port) |
2844 | 2870 | X<PERL_ALLOW_NON_IFS_LSP> |
2845 | 2871 | |
2846 | 2872 | =begin original |
2847 | 2873 | |
2848 | Set to 1 to allow the use of non-IFS compatible LSPs | |
2874 | Set to 1 to allow the use of non-IFS compatible LSP's. | |
2849 | 2875 | Perl normally searches for an IFS-compatible LSP because this is required |
2850 | 2876 | for its emulation of Windows sockets as real filehandles. However, this may |
2851 | cause problems if you have a firewall such as | |
2877 | cause problems if you have a firewall such as McAfee Guardian which requires | |
2852 | ||
2878 | all applications to use its LSP which is not IFS-compatible, because clearly | |
2853 | 2879 | Perl will normally avoid using such an LSP. |
2880 | Setting this environment variable to 1 means that Perl will simply use the | |
2881 | first suitable LSP enumerated in the catalog, which keeps McAfee Guardian | |
2882 | happy (and in that particular case Perl still works too because McAfee | |
2883 | Guardian's LSP actually plays some other games which allow applications | |
2884 | requiring IFS compatibility to work). | |
2854 | 2885 | |
2855 | 2886 | =end original |
2856 | 2887 | |
2857 | 1 にセットすると、IFS 非互換の LSP | |
2888 | 1 にセットすると、IFS 非互換の LSP を使えるようにします。 | |
2858 | 使えるようにします。 | |
2859 | 2889 | Perl は普通 IFS 互換の LSP を探します; Windows のソケットを本当の |
2860 | 2890 | ファイルハンドルとしてエミュレートするために必要だからです。 |
2861 | 2891 | しかし、これは全てのアプリケーションが IFS 非互換の自身の LSP を使うことを |
2862 | 求める | |
2892 | 求める McAfee Guardian のようなファイアウォールでは問題が起きます; | |
2863 | 2893 | 明らかに、Perl は普通そのような LSP を使うことを避けるからです。 |
2864 | ||
2865 | =begin original | |
2866 | ||
2867 | Setting this environment variable to 1 means that Perl will simply use the | |
2868 | first suitable LSP enumerated in the catalog, which keeps I<McAfee Guardian> | |
2869 | happy--and in that particular case Perl still works too because I<McAfee | |
2870 | Guardian>'s LSP actually plays other games which allow applications | |
2871 | requiring IFS compatibility to work. | |
2872 | ||
2873 | =end original | |
2874 | ||
2875 | 2894 | この環境変数を 1 にセットすることで、 Perl は単にカタログに挙げられている |
2876 | もののうち最初の適切な LSP を使用し、これにより | |
2895 | もののうち最初の適切な LSP を使用し、これにより McAfee Guardian は | |
2877 | 幸せなままです | |
2896 | 幸せなままです (そしてこの特定の場合においては、McAfee Guardian の LSP は | |
2878 | 2897 | 実際には動作するために IFS 互換である必要があるアプリケーションのために |
2879 | 小細工をしているので、 Perl も正しく動きます。 | |
2898 | 小細工をしているので、 Perl も正しく動きます)。 | |
2880 | 2899 | |
2881 | 2900 | =item PERL_DEBUG_MSTATS |
2882 | 2901 | X<PERL_DEBUG_MSTATS> |
2883 | 2902 | |
2884 | 2903 | =begin original |
2885 | 2904 | |
2886 | Relevant only if | |
2905 | Relevant only if perl is compiled with the malloc included with the perl | |
2887 | distribution | |
2906 | distribution (that is, if C<perl -V:d_mymalloc> is 'define'). | |
2907 | If set, this causes memory statistics to be dumped after execution. If set | |
2889 | ||
2908 | to an integer greater than one, also causes memory statistics to be dumped | |
2890 | ||
2891 | Perl が Perl 配布パッケージに含まれる malloc ルーチンを使って | |
2892 | コンパイルされている場合にのみ有効です; つまり C<perl -V:d_mymalloc> が | |
2893 | "define" の場合です。 | |
2894 | ||
2895 | =begin original | |
2896 | ||
2897 | If set, this dumps out memory statistics after execution. If set | |
2898 | to an integer greater than one, also dumps out memory statistics | |
2899 | 2909 | after compilation. |
2900 | 2910 | |
2901 | 2911 | =end original |
2902 | 2912 | |
2913 | Perl が Perl 配布パッケージに含まれる malloc ルーチンを使って | |
2914 | コンパイルされている場合(C<perl -V:d_mymalloc> が 'define' の場合)にのみ | |
2915 | 有効です。 | |
2903 | 2916 | 設定されると、実行後にメモリ状況が表示されます。 |
2904 | 2917 | 1 を超える数値が設定されると、コンパイル後にもメモリ状況を表示します。 |
2905 | 2918 | |
2906 | 2919 | =item PERL_DESTRUCT_LEVEL |
2907 | 2920 | X<PERL_DESTRUCT_LEVEL> |
2908 | 2921 | |
2909 | 2922 | =begin original |
2910 | 2923 | |
2911 | ||
2924 | Relevant only if your perl executable was built with B<-DDEBUGGING>, | |
2912 | ||
2925 | this controls the behavior of global destruction of objects and other | |
2926 | references. See L<perlhack/PERL_DESTRUCT_LEVEL> for more information. | |
2913 | 2927 | |
2914 | 2928 | =end original |
2915 | 2929 | |
2916 | ||
2930 | Perl の実行ファイルが B<-DDEBUGGING> 付きで構築された場合にのみ有効です。 | |
2931 | このオプションはオブジェクトやその他のリファレンスのグローバルな | |
2917 | 2932 | デストラクタの振る舞いを制御します。 |
2918 | 2933 | さらなる情報については L<perlhack/PERL_DESTRUCT_LEVEL> を参照してください。 |
2919 | 2934 | |
2920 | 2935 | =item PERL_DL_NONLAZY |
2921 | 2936 | X<PERL_DL_NONLAZY> |
2922 | 2937 | |
2923 | 2938 | =begin original |
2924 | 2939 | |
2925 | Set to | |
2940 | Set to one to have perl resolve B<all> undefined symbols when it loads | |
2926 | 2941 | a dynamic library. The default behaviour is to resolve symbols when |
2927 | 2942 | they are used. Setting this variable is useful during testing of |
2928 | extensions | |
2943 | extensions as it ensures that you get an error on misspelled function | |
2929 | names even if the test suite doesn't call t | |
2944 | names even if the test suite doesn't call it. | |
2930 | 2945 | |
2931 | 2946 | =end original |
2932 | 2947 | |
2933 | 2948 | 1 にセットすると、 Perl は B<全ての> 未定義シンボルをダイナミック |
2934 | 2949 | ライブラリをロードしたときに解決します。 |
2935 | 2950 | デフォルトの振る舞いは使われるときにシンボルを解決します。 |
2936 | 2951 | この変数を設定することで、拡張機能のテスト時にたとえテストスイートが |
2937 | 2952 | 呼び出さなくても関数名のスペルミスによるエラーを確実に受け取ることが |
2938 | 2953 | できるので便利です。 |
2939 | 2954 | |
2940 | 2955 | =item PERL_ENCODING |
2941 | 2956 | X<PERL_ENCODING> |
2942 | 2957 | |
2943 | 2958 | =begin original |
2944 | 2959 | |
2945 | If using the C< | |
2960 | If using the C<encoding> pragma without an explicit encoding name, the | |
2946 | 2961 | PERL_ENCODING environment variable is consulted for an encoding name. |
2947 | 2962 | |
2948 | 2963 | =end original |
2949 | 2964 | |
2950 | C< | |
2965 | C<encoding> プラグマを明示的なエンコーディング名を指定せずに使用した場合、 | |
2951 | 2966 | PERL_ENCODING 環境変数がエンコーディング名として使われます。 |
2952 | 2967 | |
2953 | 2968 | =item PERL_HASH_SEED |
2954 | 2969 | X<PERL_HASH_SEED> |
2955 | 2970 | |
2956 | 2971 | =begin original |
2957 | 2972 | |
2958 | (Since Perl 5.8.1 | |
2973 | (Since Perl 5.8.1.) Used to randomise perl's internal hash function. | |
2959 | ||
2974 | To emulate the pre-5.8.1 behaviour, set to an integer (zero means | |
2960 | ||
2975 | exactly the same order as 5.8.0). "Pre-5.8.1" means, among other | |
2961 | ||
2976 | things, that hash keys will always have the same ordering between | |
2977 | different runs of perl. | |
2962 | 2978 | |
2963 | 2979 | =end original |
2964 | 2980 | |
2965 | (Perl 5.8.1 から | |
2981 | (Perl 5.8.1 から) perl の内部ハッシュ関数のランダム化に使われます。 | |
2966 | ||
2982 | 5.8.1 以前の振る舞いをエミュレートするためには、整数を指定します | |
2967 | ||
2983 | (ゼロは 5.8.0 と完全に同じ順序を意味します)。 | |
2968 | ||
2984 | "5.8.1 以前" というのは、その他のことも含めて、Perl を何度実行しても | |
2985 | ハッシュキーの並び順が常に同じであることを意味します。 | |
2969 | 2986 | |
2970 | 2987 | =begin original |
2971 | 2988 | |
2972 | ||
2989 | Most hashes return elements in the same order as Perl 5.8.0 by default. | |
2973 | a | |
2990 | On a hash by hash basis, if pathological data is detected during a hash | |
2974 | ||
2991 | key insertion, then that hash will switch to an alternative random hash | |
2975 | ||
2992 | seed. | |
2976 | documentation for L<PERL_PERTURB_KEYS|/PERL_PERTURB_KEYS> for important | |
2977 | caveats regarding the C<DETERMINISTIC> mode. | |
2978 | 2993 | |
2979 | 2994 | =end original |
2980 | 2995 | |
2981 | ||
2996 | Perl 5.8.0 ではデフォルトではほとんどのハッシュは同じ順序で要素を返します。 | |
2982 | ||
2997 | ハッシュからハッシュの単位で、ハッシュキー挿入中に異常なデータが検出されると、 | |
2983 | ||
2998 | ハッシュは代替のランダムハッシュの種に切り替えます。 | |
2984 | C<PERL_PERTURB_KEYS=2>/C<PERL_PERTURB_KEYS=DETERMINISTIC> として扱います。 | |
2985 | C<DETERMINISTIC> モードに関する重要な問題点については | |
2986 | L<PERL_PERTURB_KEYS|/PERL_PERTURB_KEYS> の文書を参照してください。 | |
2987 | 2999 | |
2988 | 3000 | =begin original |
2989 | 3001 | |
2990 | ||
3002 | The default behaviour is to randomise unless the PERL_HASH_SEED is set. | |
2991 | ||
3003 | If perl has been compiled with C<-DUSE_HASH_SEED_EXPLICIT>, the default | |
2992 | ||
3004 | behaviour is B<not> to randomise unless the PERL_HASH_SEED is set. | |
2993 | completely lost. | |
2994 | 3005 | |
2995 | 3006 | =end original |
2996 | 3007 | |
2997 | ||
3008 | デフォルトの振る舞いは、PERL_HASH_SEED がセットされない限り | |
2998 | ハッシュは Perl コードに対するローカル・リモート攻撃から守るために | |
2999 | 3009 | ランダム化されます。 |
3000 | ||
3010 | perl が C<-DUSE_HASH_SEED_EXPLICIT> 付きでコンパイルされた場合、 | |
3011 | デフォルトの振る舞いは PERL_HASH_SEED がセットされない限り | |
3012 | ランダム化 B<されません>。 | |
3001 | 3013 | |
3002 | 3014 | =begin original |
3003 | 3015 | |
3004 | ||
3016 | If PERL_HASH_SEED is unset or set to a non-numeric string, perl uses | |
3005 | ||
3017 | the pseudorandom seed supplied by the operating system and libraries. | |
3006 | 3018 | |
3007 | 3019 | =end original |
3008 | 3020 | |
3009 | ||
3021 | PERL_HASH_SEED がセットされないか、数値でない文字列がセットされた場合、 | |
3010 | ||
3022 | Perl はオペレーティングシステムとライブラリが提供する擬似乱数の | |
3023 | 種を使用します。 | |
3011 | 3024 | |
3012 | =item PERL_PERTURB_KEYS | |
3013 | X<PERL_PERTURB_KEYS> | |
3014 | ||
3015 | 3025 | =begin original |
3016 | 3026 | |
3017 | ||
3027 | B<Please note that the hash seed is sensitive information>. Hashes are | |
3018 | ||
3028 | randomized to protect against local and remote attacks against Perl | |
3019 | ||
3029 | code. By manually setting a seed this protection may be partially or | |
3020 | ||
3030 | completely lost. | |
3021 | this mode is as close to pre 5.18 behavior as you can get. | |
3022 | 3031 | |
3023 | 3032 | =end original |
3024 | 3033 | |
3025 | ||
3034 | B<ハッシュの種は微妙な問題であることに注意してください>。 | |
3026 | ||
3035 | ハッシュは Perl コードに対するローカル・リモート攻撃から守るために | |
3027 | ||
3036 | ランダム化されます。 | |
3028 | ||
3037 | 手動で種を設定することによりこの守りは部分的に、あるいは完全に失われます。 | |
3029 | 振る舞いに近づきます。 | |
3030 | 3038 | |
3031 | 3039 | =begin original |
3032 | 3040 | |
3033 | ||
3041 | See L<perlsec/"Algorithmic Complexity Attacks"> and | |
3034 | E | |
3042 | L</PERL_HASH_SEED_DEBUG> for more information. | |
3035 | fashion. The order may not be repeatable in a following program run | |
3036 | even if the PERL_HASH_SEED has been specified. This is the default | |
3037 | mode for perl when no PERL_HASH_SEED has been explicitly provided. | |
3038 | 3043 | |
3039 | 3044 | =end original |
3040 | 3045 | |
3041 | ||
3046 | さらなる情報については L<perlsec/"Algorithmic Complexity Attacks"> と | |
3042 | ||
3047 | L</PERL_HASH_SEED_DEBUG> を参照してください。 | |
3043 | 順序は、PERL_HASH_SEED が指定されていても、プログラムを再び実行したときに | |
3044 | 再現できません。 | |
3045 | これは、PERL_HASH_SEED が明示的に設定されていない場合は、 | |
3046 | perl のデフォルトのモードです。 | |
3047 | 3048 | |
3048 | =begin original | |
3049 | ||
3050 | When set to C<"2"> or C<"DETERMINISTIC"> then inserting keys into a hash | |
3051 | will cause the key order to change, but in a way that is repeatable from | |
3052 | program run to program run, provided that the same hash seed is used, | |
3053 | and that the code does not itself perform any non-deterministic | |
3054 | operations and also provided exactly the same environment context. | |
3055 | Adding or removing an environment variable may and likely will change | |
3056 | the key order. If any part of the code builds a hash using non- | |
3057 | deterministic keys, for instance a hash keyed by the stringified form of | |
3058 | a reference, or the address of the objects it contains, then this may | |
3059 | and likely will have a global effect on the key order of *every* hash in | |
3060 | the process. To work properly this setting MUST be coupled with the | |
3061 | L<PERL_HASH_SEED|/"PERL_HASH_SEED"> to produce deterministic results, | |
3062 | and in fact, if you do set the C<PERL_HASH_SEED> explicitly you do not | |
3063 | need to set this as well, it will be automatically set to this mode. | |
3064 | ||
3065 | =end original | |
3066 | ||
3067 | C<"2"> または C<"DETERMINISTIC"> に設定すると、ハッシュへのキーの挿入によって | |
3068 | キーの順序が変わりますが、同じハッシュキーが使われ、 | |
3069 | コード自体が非決定的な操作をせず、正確に同じ環境コンテキストを | |
3070 | 提供すれば、プログラムを再び実行したときには再現可能です。 | |
3071 | 環境変数を追加または削除すると、おそらくキーの順序が変わりますう。 | |
3072 | コードのどこかが非決定的なキーを使ったハッシュ、 | |
3073 | 例えばリファレンスの文字列化形式や、それを含むオブジェクトのアドレスを | |
3074 | キーにしたハッシュを構築すると、これはおそらくプロセス中の | |
3075 | 「全ての」ハッシュのキーの順序にグローバルな影響を与えます。 | |
3076 | これが正しく動作するには、決定的な結果を生成するために | |
3077 | L<PERL_HASH_SEED|/"PERL_HASH_SEED"> と共に使われなければならず、 | |
3078 | 実際の所、C<PERL_HASH_SEED> を明示的に設定した場合、 | |
3079 | これも設定する必要はありません; 自動的にこのモードに設定されます。 | |
3080 | ||
3081 | =begin original | |
3082 | ||
3083 | B<NOTE:> Use of this option is considered insecure, and is intended only | |
3084 | for debugging non-deterministic behavior in Perl's hash function. Do | |
3085 | not use it in production. | |
3086 | ||
3087 | =end original | |
3088 | ||
3089 | B<注意:> このオプションはセキュアではないと考えられていて、Perl のハッシュ関数の | |
3090 | 非決定的な振る舞いのデバッグ専用であることを意図しています。 | |
3091 | 製品で使わないでください。 | |
3092 | ||
3093 | =begin original | |
3094 | ||
3095 | See L<perlsec/"Algorithmic Complexity Attacks"> and L</PERL_HASH_SEED> | |
3096 | and L</PERL_HASH_SEED_DEBUG> for more information. You can get and set the | |
3097 | key traversal mask for a specific hash by using the C<hash_traversal_mask()> | |
3098 | function from L<Hash::Util>. | |
3099 | ||
3100 | =end original | |
3101 | ||
3102 | さらなる情報については L<perlsec/"Algorithmic Complexity Attacks">, | |
3103 | L</PERL_HASH_SEED>, L</PERL_HASH_SEED_DEBUG> を参照してください。 | |
3104 | L<Hash::Util> にある C<hash_traversal_mask()> を使うことで、特定のハッシュに | |
3105 | 対するキー探索マスクを取得および設定できます。 | |
3106 | ||
3107 | 3049 | =item PERL_HASH_SEED_DEBUG |
3108 | 3050 | X<PERL_HASH_SEED_DEBUG> |
3109 | 3051 | |
3110 | 3052 | =begin original |
3111 | 3053 | |
3112 | (Since Perl 5.8.1.) Set to | |
3054 | (Since Perl 5.8.1.) Set to one to display (to STDERR) the value of | |
3113 | ||
3055 | the hash seed at the beginning of execution. This, combined with | |
3114 | ||
3056 | L</PERL_HASH_SEED> is intended to aid in debugging nondeterministic | |
3115 | ||
3057 | behavior caused by hash randomization. | |
3116 | debugging nondeterministic behaviour caused by hash randomization. | |
3117 | 3058 | |
3118 | 3059 | =end original |
3119 | 3060 | |
3120 | (Perl 5.8.1 から | |
3061 | (Perl 5.8.1 から) これを 1 に設定すると、実行開始時にハッシュの種の | |
3121 | ||
3062 | 値を画面(STDERR)に出力します。 | |
3122 | ランダム化 | |
3063 | これは L</PERL_HASH_SEED> と組み合わせることでハッシュのランダム化に | |
3123 | ||
3064 | よる非決定的な振る舞いのデバッグを助けることを目的としています。 | |
3124 | ハッシュのランダム化による非決定的な振る舞いのデバッグを助けることを | |
3125 | 目的としています。 | |
3126 | 3065 | |
3127 | 3066 | =begin original |
3128 | 3067 | |
3129 | B<Note | |
3068 | B<Note that the hash seed is sensitive information>: by knowing it one | |
3130 | ||
3069 | can craft a denial-of-service attack against Perl code, even remotely, | |
3131 | ||
3070 | see L<perlsec/"Algorithmic Complexity Attacks"> for more information. | |
3132 | ||
3071 | B<Do not disclose the hash seed> to people who don't need to know it. | |
3133 | ||
3072 | See also hash_seed() of L<Hash::Util>. | |
3134 | L<C<hash_traversal_mask()>|Hash::Util/hash_traversal_mask>. | |
3135 | 3073 | |
3136 | 3074 | =end original |
3137 | 3075 | |
3138 | ハッシュ | |
3076 | B<ハッシュの種は微妙な問題であることに注意してください>: | |
3139 | ||
3077 | これを知ることで、リモートからでも Perl のコードに対してサービス拒否攻撃を | |
3140 | ||
3078 | 仕掛けることが出来ます。 | |
3141 | L<perlsec/"Algorithmic Complexity Attacks"> を | |
3079 | さらなる情報については L<perlsec/"Algorithmic Complexity Attacks"> を | |
3142 | 知る必要のない人々に対して B<ハッシュの種を公開しないでください>。 | |
3143 | L<C<hash_seed()>|Hash::Util/hash_seed> と | |
3144 | L<C<hash_traversal_mask()>|Hash::Util/hash_traversal_mask> も | |
3145 | 3080 | 参照してください。 |
3081 | 知る必要のない人々に対して B<ハッシュの種を公開しないでください>。 | |
3082 | L<Hash::Util> の hash_seed() も参照してください。 | |
3146 | 3083 | |
3147 | =begin original | |
3148 | ||
3149 | An 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 | |
3158 | X<PERL_MEM_LOG> | |
3159 | ||
3160 | =begin original | |
3161 | ||
3162 | If your Perl was configured with B<-Accflags=-DPERL_MEM_LOG>, setting | |
3163 | the environment variable C<PERL_MEM_LOG> enables logging debug | |
3164 | messages. The value has the form C<< <I<number>>[m][s][t] >>, where | |
3165 | C<I<number>> is the file descriptor number you want to write to (2 is | |
3166 | default), and the combination of letters specifies that you want | |
3167 | information about (m)emory and/or (s)v, optionally with | |
3168 | (t)imestamps. For example, C<PERL_MEM_LOG=1mst> logs all | |
3169 | information to stdout. You can write to other opened file descriptors | |
3170 | in a variety of ways: | |
3171 | ||
3172 | =end original | |
3173 | ||
3174 | Perl が B<-Accflags=-DPERL_MEM_LOG> で設定されていると、環境変数 | |
3175 | C<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 | ||
3184 | 3084 | =item PERL_ROOT (specific to the VMS port) |
3185 | 3085 | X<PERL_ROOT> |
3186 | 3086 | |
3187 | 3087 | =begin original |
3188 | 3088 | |
3189 | A translation | |
3089 | A translation concealed rooted logical name that contains perl and the | |
3190 | 3090 | logical device for the @INC path on VMS only. Other logical names that |
3191 | affect | |
3091 | affect perl on VMS include PERLSHR, PERL_ENV_TABLES, and | |
3192 | SYS$TIMEZONE_DIFFERENTIAL | |
3092 | SYS$TIMEZONE_DIFFERENTIAL but are optional and discussed further in | |
3193 | 3093 | L<perlvms> and in F<README.vms> in the Perl source distribution. |
3194 | 3094 | |
3195 | 3095 | =end original |
3196 | 3096 | |
3197 | 3097 | Perl と VMS 専用の @INC のための論理デバイスを含む、 |
3198 | 3098 | 変換が隠されたルートとなる論理名です。 |
3199 | 3099 | VMS の Perl に影響を与えるその他の論理名としては PERLSHR, PERL_ENV_TABLES, |
3200 | SYS$TIMEZONE_DIFFERENTIAL がありますが、これらはオプションです | |
3100 | SYS$TIMEZONE_DIFFERENTIAL がありますが、これらはオプションです。 | |
3201 | 3101 | 詳細については Perl ソース配布パッケージの L<perlvms> と F<README.vms> で |
3202 | 3102 | 議論されています。 |
3203 | 3103 | |
3204 | 3104 | =item PERL_SIGNALS |
3205 | 3105 | X<PERL_SIGNALS> |
3206 | 3106 | |
3207 | 3107 | =begin original |
3208 | 3108 | |
3209 | ||
3109 | In Perls 5.8.1 and later. If set to C<unsafe> the pre-Perl-5.8.0 | |
3210 | signal behaviour ( | |
3110 | signals behaviour (immediate but unsafe) is restored. If set to | |
3211 | ||
3111 | C<safe> the safe (or deferred) signals are used. | |
3212 | L<perlipc/"Deferred Signals (Safe Signals)">. | |
3112 | See L<perlipc/"Deferred Signals (Safe Signals)">. | |
3213 | 3113 | |
3214 | 3114 | =end original |
3215 | 3115 | |
3216 | 3116 | Perl 5.8.1 以降で有効です。 |
3217 | 3117 | これに C<unsafe> をセットすると、Perl 5.8.0 以前のシグナルの振る舞い |
3218 | 3118 | (直接的ですが安全ではありません)が復元されます。 |
3219 | C<safe> | |
3119 | C<safe>をセットすると安全な(遅延する)シグナルが使われます。 | |
3220 | 3120 | L<perlipc/"Deferred Signals (Safe Signals)"> を参照してください。 |
3221 | 3121 | |
3222 | 3122 | =item PERL_UNICODE |
3223 | 3123 | X<PERL_UNICODE> |
3224 | 3124 | |
3225 | 3125 | =begin original |
3226 | 3126 | |
3227 | Equivalent to the | |
3127 | Equivalent to the B<-C> command-line switch. Note that this is not | |
3228 | ||
3128 | a boolean variable-- setting this to C<"1"> is not the right way to | |
3229 | ||
3129 | "enable Unicode" (whatever that would mean). You can use C<"0"> to | |
3230 | ||
3130 | "disable Unicode", though (or alternatively unset PERL_UNICODE in | |
3231 | ||
3131 | your shell before starting Perl). See the description of the C<-C> | |
3232 | ||
3132 | switch for more information. | |
3233 | 3133 | |
3234 | 3134 | =end original |
3235 | 3135 | |
3236 | ||
3136 | B<-C> コマンドラインスイッチと等価です。 | |
3237 | これは真偽値変数ではないことに注意してください | |
3137 | これは真偽値変数ではないことに注意してください -- これを C<"1"> に | |
3238 | ||
3138 | セットすることは(どんな意味においても)"Unicode を有効にする"ための | |
3239 | ||
3139 | 正しい方法ではありません。 | |
3240 | しかし、 | |
3140 | しかし、"Unicode を無効にする"ために C<"0"> をセットすることは出来ます | |
3241 | 3141 | (あるいは Perl の起動前にあなたのお使いのシェルで PERL_UNICODE を |
3242 | 3142 | 未設定にすることでも出来ます)。 |
3243 | さらなる情報については | |
3143 | さらなる情報については C<-C> スイッチの説明を参照してください。 | |
3244 | 参照してください。 | |
3245 | 3144 | |
3246 | =item PERL_USE_UNSAFE_INC | |
3247 | X<PERL_USE_UNSAFE_INC> | |
3248 | ||
3249 | =begin original | |
3250 | ||
3251 | If perl has been configured to not have the current directory in | |
3252 | L<C<@INC>|perlvar/@INC> by default, this variable can be set to C<"1"> | |
3253 | to reinstate it. It's primarily intended for use while building and | |
3254 | testing modules that have not been updated to deal with "." not being in | |
3255 | C<@INC> and should not be set in the environment for day-to-day use. | |
3256 | ||
3257 | =end original | |
3258 | ||
3259 | perl がデフォルトで L<C<@INC>|perlvar/@INC> にカレントディレクトリを | |
3260 | 含まないように設定されている場合、 | |
3261 | これを再設定するためにこの変数を C<"1"> にできます。 | |
3262 | これは、C<@INC> に "." がなくても動作するように更新されていないモジュールの | |
3263 | ビルドとテストのために使うことを第一の目的としているので、 | |
3264 | 日常使用環境では設定するべきではありません。 | |
3265 | ||
3266 | 3145 | =item SYS$LOGIN (specific to the VMS port) |
3267 | 3146 | X<SYS$LOGIN> |
3268 | 3147 | |
3269 | 3148 | =begin original |
3270 | 3149 | |
3271 | Used if chdir has no argument and | |
3150 | Used if chdir has no argument and HOME and LOGDIR are not set. | |
3272 | 3151 | |
3273 | 3152 | =end original |
3274 | 3153 | |
3275 | chdir の引数がなく、 | |
3154 | chdir の引数がなく、HOME と LOGDIR がセットされていないときに使われます。 | |
3276 | L</LOGDIR> がセットされていないときに使われます。 | |
3277 | 3155 | |
3278 | =item PERL_INTERNAL_RAND_SEED | |
3279 | X<PERL_INTERNAL_RAND_SEED> | |
3280 | ||
3281 | =begin original | |
3282 | ||
3283 | Set to a non-negative integer to seed the random number generator used | |
3284 | internally by perl for a variety of purposes. | |
3285 | ||
3286 | =end original | |
3287 | ||
3288 | 様々な目的のために、perl によって内部で使われる乱数生成器の種となる | |
3289 | 非負整数を設定します。 | |
3290 | ||
3291 | =begin original | |
3292 | ||
3293 | Ignored if perl is run setuid or setgid. Used only for some limited | |
3294 | startup randomization (hash keys) if C<-T> or C<-t> perl is started | |
3295 | with tainting enabled. | |
3296 | ||
3297 | =end original | |
3298 | ||
3299 | perl が setuid または setgid で実行されている場合は無視されます。 | |
3300 | C<-T> や C<-t> perl が汚染モードを有効にして開始された場合、 | |
3301 | 一部の制限されたランダム化の設定(ハッシュキー)のみに使われます。 | |
3302 | ||
3303 | =begin original | |
3304 | ||
3305 | Perl may be built to ignore this variable. | |
3306 | ||
3307 | =end original | |
3308 | ||
3309 | Perl はこの変数を無視するようにビルドされているかもしれません。 | |
3310 | ||
3311 | =item PERL_RAND_SEED | |
3312 | X<PERL_RAND_SEED> | |
3313 | ||
3314 | =begin original | |
3315 | ||
3316 | When set to an integer value this value will be used to seed the perl | |
3317 | internal random number generator used for C<rand()> when it is used | |
3318 | without an explicit C<srand()> call or for when an explicit no-argument | |
3319 | C<srand()> call is made. | |
3320 | ||
3321 | =end original | |
3322 | ||
3323 | 整数が設定されると、この値は、 | |
3324 | 明示的な C<srand()> 呼び出しがなかったり、引数なしでの明示的な | |
3325 | C<srand()> 呼び出しが行われたとき、 | |
3326 | C<rand()> のための perl 内部の乱数生成器の種として使われます。 | |
3327 | ||
3328 | =begin original | |
3329 | ||
3330 | Normally calling C<rand()> prior to calling C<srand()> or calling | |
3331 | C<srand()> explicitly with no arguments should result in the random | |
3332 | number generator using "best efforts" to seed the generator state with a | |
3333 | relatively high quality random seed. When this environment variable is | |
3334 | set then the seeds used will be deterministically computed from the | |
3335 | value provided in the env var in such a way that the application process | |
3336 | and any forks or threads should continue to have their own unique seed but | |
3337 | that the program may be run twice with identical results as far as | |
3338 | C<rand()> goes (assuming all else is equal). | |
3339 | ||
3340 | =end original | |
3341 | ||
3342 | 通常、C<srand()> の前に C<rand()> を呼び出したり、引数なしで明示的に | |
3343 | C<srand()> を呼び出した場合、 | |
3344 | 比較的高品質な乱数の種によって生成器の状態に | |
3345 | 種を設定するために、乱数生成器は「ベストエフォート」を行います。 | |
3346 | この環境変数が設定されると、使われる種は、 | |
3347 | アプリケーションプロセスとそのフォークやスレッドがそれぞれ固有の | |
3348 | ユニークな種を持ち続けれるけれども、 | |
3349 | プログラムが 2 回実行されても、C<rand()> に関しては (他の全てが同じなら) | |
3350 | 同じ結果になるような方法で、決定論的に計算されます。 | |
3351 | ||
3352 | =begin original | |
3353 | ||
3354 | PERL_RAND_SEED is intended for performance measurements and debugging | |
3355 | and is explicitly NOT intended for stable testing. The only guarantee is | |
3356 | that a specific perl executable will produce the same results twice in a | |
3357 | row, there is no guarantee that the results will be the same between | |
3358 | perl releases or on different architectures. | |
3359 | ||
3360 | =end original | |
3361 | ||
3362 | PERL_RAND_SEED は性能計測とデバッグを意図したもので、 | |
3363 | 安定したテストを意図したものでは明示的に異なります。 | |
3364 | 保証されることは、特定の perl バイナリが 2 回同じ結果を | |
3365 | 出力することだけであり、 | |
3366 | perl リリースが異なったりアーキテクチャがことなったりしたときの | |
3367 | 結果は保証しません。 | |
3368 | ||
3369 | =begin original | |
3370 | ||
3371 | Ignored if perl is run setuid or setgid. | |
3372 | ||
3373 | =end original | |
3374 | ||
3375 | perl が setuid または setgid で実行されると、これは無視されます。 | |
3376 | ||
3377 | 3156 | =back |
3378 | 3157 | |
3379 | 3158 | =begin original |
3380 | 3159 | |
3381 | 3160 | Perl also has environment variables that control how Perl handles data |
3382 | specific to particular natural languages | |
3161 | specific to particular natural languages. See L<perllocale>. | |
3383 | 3162 | |
3384 | 3163 | =end original |
3385 | 3164 | |
3386 | 3165 | 特定の自然言語に特有のデータを Perl がどのように扱うかを制御する |
3387 | 環境変数もあります | |
3166 | 環境変数もあります。 | |
3167 | L<perllocale> を参照して下さい。 | |
3388 | 3168 | |
3389 | 3169 | =begin original |
3390 | 3170 | |
3391 | ||
3171 | Apart from these, Perl uses no other environment variables, except | |
3392 | ||
3172 | to make them available to the program being executed, and to child | |
3393 | ||
3173 | processes. However, programs running setuid would do well to execute | |
3394 | ||
3174 | the following lines before doing anything else, just to keep people | |
3395 | ||
3175 | honest: | |
3396 | variables peculiar to those specific situations. | |
3397 | 3176 | |
3398 | 3177 | =end original |
3399 | 3178 | |
3400 | ||
3179 | これらの他には、実行されているプログラムあるいは子プロセスがが有効に | |
3401 | ||
3180 | しない限り、Perl は環境変数を使いません。 | |
3402 | その一部は特定のプラットフォームに固有です。 | |
3403 | そのような特定の状況に特有の変数については適切なモジュールの文書と | |
3404 | (L<perlsolaris>, L<perllinux>, L<perlmacosx>, L<perlwin32> などのような) | |
3405 | プラットフォームの文書を参照してください。 | |
3406 | ||
3407 | =begin original | |
3408 | ||
3409 | Perl makes all environment variables available to the program being | |
3410 | executed, and passes these along to any child processes it starts. | |
3411 | However, programs running setuid would do well to execute the following | |
3412 | lines before doing anything else, just to keep people honest: | |
3413 | ||
3414 | =end original | |
3415 | ||
3416 | Perl は、実行されたプログラムへの全ての環境変数を利用可能にし、 | |
3417 | 子プロセスが開始されたときにはそれらを渡します。 | |
3418 | 3181 | しかし、setuid で動作するプログラムは何かをする前に、単に人々に変な気を |
3419 | 3182 | 起こさせないために以下のコードを入れておくのがよいです。 |
3420 | 3183 | |
3421 | $ENV{PATH} = | |
3184 | $ENV{PATH} = '/bin:/usr/bin'; # or whatever you need | |
3422 | $ENV{SHELL} = | |
3185 | $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; | |
3423 | 3186 | delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; |
3424 | ||
3425 | =head1 ORDER OF APPLICATION | |
3426 | ||
3427 | (適用の順序) | |
3428 | ||
3429 | =begin original | |
3430 | ||
3431 | Some options, in particular C<-I>, C<-M>, C<PERL5LIB> and C<PERL5OPT> can | |
3432 | interact, 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 | ||
3441 | Note that this section does not document what I<actually> happens inside the | |
3442 | perl 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 | ||
3456 | The effect of multiple C<-I> options is to C<unshift> them onto C<@INC> | |
3457 | from 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 | ||
3469 | will first prepend C<3> onto the front of C<@INC>, then prepend C<2>, and | |
3470 | then 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 | ||
3484 | Multiple 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 | ||
3495 | will first use the L<lib> pragma to prepend C<1> to C<@INC>, then | |
3496 | it will prepend C<2>, then it will prepend C<3>, resulting in an C<@INC> | |
3497 | that 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 | ||
3511 | This contains a list of directories, separated by colons. The entire list | |
3512 | is 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 | ||
3524 | will result in an C<@INC> that begins with: | |
3525 | ||
3526 | =end original | |
3527 | ||
3528 | C<@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 | ||
3538 | C<PERL5LIB> is applied first, then all the C<-I> arguments, then all the | |
3539 | C<-M> arguments. This: | |
3540 | ||
3541 | =end original | |
3542 | ||
3543 | C<PERL5LIB> は最初に適用され、それから全ての C<-I> 引数、それから全ての | |
3544 | C<-M> 引数です。 | |
3545 | これは: | |
3546 | ||
3547 | PERL5LIB=e1:e2 perl -I i1 -Mlib=m1 -I i2 -Mlib=m2 | |
3548 | ||
3549 | =begin original | |
3550 | ||
3551 | will result in an C<@INC> that begins with: | |
3552 | ||
3553 | =end original | |
3554 | ||
3555 | C<@INC> が次のもので始まる結果となります: | |
3556 | ||
3557 | qw(m2 m1 i1 i2 e1 e2) | |
3558 | ||
3559 | =item the PERL5OPT environment variable | |
3560 | ||
3561 | =begin original | |
3562 | ||
3563 | This contains a space separated list of switches. We only consider the | |
3564 | effects 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 | ||
3573 | After normal processing of C<-I> switches from the command line, all | |
3574 | the C<-I> switches in C<PERL5OPT> are extracted. They are processed from | |
3575 | left to right instead of from right to left. Also note that while | |
3576 | whitespace is allowed between a C<-I> and its directory on the command | |
3577 | line, it is not allowed in C<PERL5OPT>. | |
3578 | ||
3579 | =end original | |
3580 | ||
3581 | コマンドラインからの C<-I> オプションの通常の処理の後、 | |
3582 | C<PERL5OPT> の全ての C<-I> オプションが展開されます。 | |
3583 | これらは右から左ではなく、左から右に処理されます。 | |
3584 | また、コマンドラインでは C<-I とディレクトリの間に空白が許されますが、 | |
3585 | C<PERL5OPT> では許されないことにも注意してください。 | |
3586 | ||
3587 | =begin original | |
3588 | ||
3589 | After normal processing of C<-M> switches from the command line, all | |
3590 | the C<-M> switches in C<PERL5OPT> are extracted. They are processed from | |
3591 | left to right, I<i.e.> the same as those on the command line. | |
3592 | ||
3593 | =end original | |
3594 | ||
3595 | コマンドラインからの C<-M> オプションの通常の処理の後、 | |
3596 | C<PERL5OPT> の全ての C<-M> オプションが展開されました。 | |
3597 | これらは左から右に処理されます; I<つまり> コマンドラインと同じです。 | |
3598 | ||
3599 | =begin original | |
3600 | ||
3601 | An 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 | ||
3613 | will result in an C<@INC> that begins with: | |
3614 | ||
3615 | =end original | |
3616 | ||
3617 | C<@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 | ||
3642 | There 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 | ||
3656 | All of C<-I>, C<PERL5LIB> and C<use lib> will also prepend arch and version | |
3657 | subdirs if they are present | |
3658 | ||
3659 | =end original | |
3660 | ||
3661 | C<-I>, C<PERL5LIB>, C<use lib> の全ては、 | |
3662 | (存在すれば) arch と version サブディレクトリが前置されます。 | |
3663 | ||
3664 | =item sitecustomize.pl | |
3665 | ||
3666 | =back | |
3667 | ||
3668 | =back | |
3669 | 3187 | |
3670 | 3188 | =begin meta |
3671 | 3189 | |
3672 | 3190 | Translate: 吉村 寿人 <JAE00534@niftyserve.or.jp> |
3673 | 3191 | Update: SHIRAKATA Kentaro <argrath@ub32.org> |
3674 | 3192 | Status: completed |
3675 | 3193 | |
3676 | 3194 | =end meta |