feature-1.42 > 1.54 との差分

feature 1.54 と 1.42 の差分

11
2=encoding utf8
2=encoding euc-jp
33
44=head1 NAME
55
66=begin original
77
88feature - Perl pragma to enable new features
99
1010=end original
1111
1212feature - 新しい機能を有効にするプラグマ
1313
1414=head1 SYNOPSIS
1515
1616 use feature qw(say switch);
1717 given ($foo) {
1818 when (1) { say "\$foo == 1" }
1919 when ([2,3]) { say "\$foo == 2 || \$foo == 3" }
2020 when (/^a[bc]d$/) { say "\$foo eq 'abd' || \$foo eq 'acd'" }
2121 when ($_ > 100) { say "\$foo > 100" }
2222 default { say "None of the above" }
2323 }
2424
2525 use feature ':5.10'; # loads all features available in perl 5.10
2626
2727 use v5.10; # implicitly loads :5.10 feature bundle
2828
2929=head1 DESCRIPTION
3030
3131=begin original
3232
3333It is usually impossible to add new syntax to Perl without breaking
3434some existing programs. This pragma provides a way to minimize that
3535risk. New syntactic constructs, or new semantic meanings to older
3636constructs, can be enabled by C<use feature 'foo'>, and will be parsed
3737only when the appropriate feature pragma is in scope. (Nevertheless, the
3838C<CORE::> prefix provides access to all Perl keywords, regardless of this
3939pragma.)
4040
4141=end original
4242
4343既に存在しているプログラムを壊すことなく、Perl に新しい文法を追加することは、
4444普通は不可能です。
4545このプラグマは、リスクを最小化する方法を提供します。
4646新しい文法構造や、古い構造の新しい意味は、C<use feature 'foo'> で有効化され、
4747適切な feature プラグマがスコープ内にある場合にのみパースされます。
4848(それでも、このプラグマに関わらず、C<CORE::> 接頭辞は全ての
4949Perl キーワードへのアクセスを提供します。)
5050
5151=head2 Lexical effect
5252
5353(レキシカルな効果)
5454
5555=begin original
5656
5757Like other pragmas (C<use strict>, for example), features have a lexical
5858effect. C<use feature qw(foo)> will only make the feature "foo" available
5959from that point to the end of the enclosing block.
6060
6161=end original
6262
6363(例えば C<use strict> のような) その他のプラグマと同様、feature は
6464レキシカルな効果を持ちます。
6565C<use feature qw(foo)> は、この地点からブロックの終わりまでの間だけ、
6666"foo" 機能を利用可能にします。
6767
6868 {
6969 use feature 'say';
7070 say "say is available here";
7171 }
7272 print "But not here.\n";
7373
7474=head2 C<no feature>
7575
7676=begin original
7777
7878Features can also be turned off by using C<no feature "foo">. This too
7979has lexical effect.
8080
8181=end original
8282
8383機能は C<no feature "foo"> を使うことで無効にすることも出来ます。
8484これもまたレキシカルな効果を持ちます。
8585
8686 use feature 'say';
8787 say "say is available here";
8888 {
8989 no feature 'say';
9090 print "But not here.\n";
9191 }
9292 say "Yet it is here.";
9393
9494=begin original
9595
9696C<no feature> with no features specified will reset to the default group. To
9797disable I<all> features (an unusual request!) use C<no feature ':all'>.
9898
9999=end original
100100
101101C<no feature> と、機能を指定せずに使うと、デフォルトグループにリセットします。
102102I<全ての> 機能を無効にする(普通でない要求!)には、C<no feature ':all'> を
103103使ってください。
104104
105105=head1 AVAILABLE FEATURES
106106
107107(利用可能な機能)
108108
109109=head2 The 'say' feature
110110
111111('say' 機能)
112112
113113=begin original
114114
115115C<use feature 'say'> tells the compiler to enable the Perl 6 style
116116C<say> function.
117117
118118=end original
119119
120120C<use feature 'say'> は、コンパイラに Perl 6 形式の C<say> 関数を
121121有効にするように伝えます。
122122
123123=begin original
124124
125125See L<perlfunc/say> for details.
126126
127127=end original
128128
129129詳しくは L<perlfunc/say> を参照してください。
130130
131131=begin original
132132
133133This feature is available starting with Perl 5.10.
134134
135135=end original
136136
137137この機能は Perl 5.10 から利用可能です。
138138
139139=head2 The 'state' feature
140140
141141('state' 機能)
142142
143143=begin original
144144
145145C<use feature 'state'> tells the compiler to enable C<state>
146146variables.
147147
148148=end original
149149
150150C<use feature 'state'> は、コンパイラに C<state> 変数を有効にするように
151151伝えます。
152152
153153=begin original
154154
155155See L<perlsub/"Persistent Private Variables"> for details.
156156
157157=end original
158158
159159詳しくは L<perlsub/"Persistent Private Variables"> を参照してください。
160160
161161=begin original
162162
163163This feature is available starting with Perl 5.10.
164164
165165=end original
166166
167167この機能は Perl 5.10 から利用可能です。
168168
169169=head2 The 'switch' feature
170170
171171('switch' 機能)
172172
173173=begin original
174174
175175B<WARNING>: Because the L<smartmatch operator|perlop/"Smartmatch Operator"> is
176176experimental, Perl will warn when you use this feature, unless you have
177177explicitly disabled the warning:
178178
179179=end original
180180
181181B<WARNING>: L<スマートマッチング演算子|perlop/"Smartmatch Operator"> は
182182実験的なので、この機能を使うと、明示的に無効にしない限り警告が発生します:
183183
184184 no warnings "experimental::smartmatch";
185185
186186=begin original
187187
188188C<use feature 'switch'> tells the compiler to enable the Perl 6
189189given/when construct.
190190
191191=end original
192192
193193C<use feature 'switch'> は、コンパイラに Perl 6 given/when 構文を
194194有効にするように伝えます。
195195
196196=begin original
197197
198198See L<perlsyn/"Switch Statements"> for details.
199199
200200=end original
201201
202202詳しくは L<perlsyn/"Switch Statements"> を参照してください。
203203
204204=begin original
205205
206206This feature is available starting with Perl 5.10.
207207
208208=end original
209209
210210この機能は Perl 5.10 から利用可能です。
211211
212212=head2 The 'unicode_strings' feature
213213
214214('unicode_strings' 機能)
215215
216216=begin original
217217
218218C<use feature 'unicode_strings'> tells the compiler to use Unicode rules
219219in all string operations executed within its scope (unless they are also
220220within the scope of either C<use locale> or C<use bytes>). The same applies
221221to all regular expressions compiled within the scope, even if executed outside
222222it. It does not change the internal representation of strings, but only how
223223they are interpreted.
224224
225225=end original
226226
227227C<use feature 'unicode_strings'> は、(C<use locale> か C<use bytes> の
228228スコープないでない限り) そのスコープ内で実行される全ての文字列操作に
229229Unicode の規則を使うようにコンパイラに伝えます。
230230これは文字列の内部表現は変更しません; それをどう解釈するかだけです。
231231
232232=begin original
233233
234234C<no feature 'unicode_strings'> tells the compiler to use the traditional
235235Perl rules wherein the native character set rules is used unless it is
236236clear to Perl that Unicode is desired. This can lead to some surprises
237237when the behavior suddenly changes. (See
238238L<perlunicode/The "Unicode Bug"> for details.) For this reason, if you are
239239potentially using Unicode in your program, the
240240C<use feature 'unicode_strings'> subpragma is B<strongly> recommended.
241241
242242=end original
243243
244244C<no feature 'unicode_strings'> は、Unicode が求められているのが
245245Perl にとって明らかでない限り、ネイティブな文字集合規則が使われるところで
246246伝統的な Perl の規則を使うようにコンパイラに伝えます。
247247これは、振る舞いが突然変更されたときに驚きを引き起こすかもしれません。
248248(詳しくは L<perlunicode/The "Unicode Bug"> を参照してください。)
249249この理由により、もしプログラムで Unicode を扱う可能性があるなら、
250250C<use feature 'unicode_strings'> 副プラグマを B<強く> 勧めます。
251251
252252=begin original
253253
254254This feature is available starting with Perl 5.12; was almost fully
255implemented in Perl 5.14; and extended in Perl 5.16 to cover C<quotemeta>;
255implemented in Perl 5.14; and extended in Perl 5.16 to cover C<quotemeta>.
256was extended further in Perl 5.26 to cover L<the range
257operator|perlop/Range Operators>; and was extended again in Perl 5.28 to
258cover L<special-cased whitespace splitting|perlfunc/split>.
259256
260257=end original
261258
262259この機能は Perl 5.12 から利用可能になりました; Perl 5.14 でほぼ完全に
263実装されました; Perl 5.16 で C<quotemeta> に対応するように拡張されました;
260実装されました; Perl 5.16 で C<quotemeta> に対応するように拡張されました
264Perl 5.26 では
265L<範囲演算子|perlop/Range Operators> に対応するようにさらに拡張されました;
266そして Perl 5.28 では
267L<特殊な場合の空白の split|perlfunc/split> に対応するように
268さらに拡張されました。
269261
270262=head2 The 'unicode_eval' and 'evalbytes' features
271263
272264('unicode_eval' と 'evalbytes' 機能)
273265
274266=begin original
275267
276Together, these two features are intended to replace the legacy string
268Under the C<unicode_eval> feature, Perl's C<eval> function, when passed a
277C<eval> function, which behaves problematically in some instances. They are
269string, will evaluate it as a string of characters, ignoring any
278available starting with Perl 5.16, and are enabled by default by a
270C<use utf8> declarations. C<use utf8> exists to declare the encoding of
279S<C<use 5.16>> or higher declaration.
271the script, which only makes sense for a stream of bytes, not a string of
272characters. Source filters are forbidden, as they also really only make
273sense on strings of bytes. Any attempt to activate a source filter will
274result in an error.
280275
281276=end original
282277
283これら二つの機能は共に古い文字列 C<eval> 関数を置き換え
278C<unicode_eval> 機能の基では、Perl C<eval> 関数に文字列が渡されると
284目的としています; これはいくつかの状況で問題のある振る舞いをします。
279文字の文字列として評価し、C<use utf8> 宣言無視します。
285これらは Perl 5.16 から利用可能で
280C<use utf8> はスクリプトのエンコーディングを宣言するために存在し
286S<C<use 5.16>> またはそれ以上宣言り、デフォルト有効になりま
281バイト並びのみ意味があり、文字の文字列は意味がありません
282ソースフィルタは禁止されます; これらもバイトの文字列に対してのみ
283意味があるからです。
284ソースフィルタを有効にしようとするあらゆる試みはエラーとなります。
287285
288286=begin original
289287
290C<unicode_eval> changes the behavior of plain string C<eval> to work more
288The C<evalbytes> feature enables the C<evalbytes> keyword, which evaluates
291consistently, especially in the Unicode world. Certain (mis)behaviors
289the argument passed to it as a string of bytes. It dies if the string
292couldn't be changed without breaking some things that had come to rely on
290contains any characters outside the 8-bit range. Source filters work
293them, so the feature can be enabled and disabled. Details are at
291within C<evalbytes>: they apply to the contents of the string being
294L<perlfunc/Under the "unicode_eval" feature>.
292evaluated.
295293
296294=end original
297295
298C<unicode_eval> は、特に Unicode の世界で、より一貫性のある動作するよう
296C<evalbytes> 機能C<evalbytes> キーワード有効します;
299単なる文字列の C<eval> の振る舞いを変更します。
297これは引数として渡されたものをバイトの文字列として評価します。
300いくつか(間違った)振る舞いは、こに依存しているものを
298文字列に 8 ビット範囲の外側の文字が含まれていると die します。
301壊さずに変更することができないので
299ソースフィルタは C<evalbytes> は動作します: これらは
302機能は有効にしたり無効にしたりできます。
300評価される文字列中身て適用されます。
303詳細は L<perlfunc/Under the "unicode_eval" feature> にあります。
304301
305302=begin original
306303
307C<evalbytes> is like string C<eval>, but operating on a byte stream that is
304Together, these two features are intended to replace the historical C<eval>
308not UTF-8 encoded. Details are at L<perlfunc/evalbytes EXPR>. Without a
305function, which has (at least) two bugs in it, that cannot easily be fixed
309S<C<use feature 'evalbytes'>> nor a S<C<use v5.16>> (or higher) declaration in
306without breaking existing programs:
310the current scope, you can still access it by instead writing
311C<CORE::evalbytes>.
312307
313308=end original
314309
315C<evalbytes> 文字列 C<eval> に似ていますが、
310これら二つの機能共に、歴史的な C<eval> 関数を置き換えることを
316UTF-8 エンコードされていなイト列操作します。
311目的としています; これには(少くとも)二つのグがあり、既存のプログラム
317詳細は L<perlfunc/evalbytes EXPR> ありま
312壊すことなく簡単修正ることができません:
318現在のスコープに S<C<use feature 'evalbytes'>> や
319S<C<use v5.16>> (またはそれ以上) の宣言がない場合でも、
320C<CORE::evalbytes> と書くことでこれにアクセスできます。
321313
314=over
315
316=item *
317
318=begin original
319
320C<eval> behaves differently depending on the internal encoding of the
321string, sometimes treating its argument as a string of bytes, and sometimes
322as a string of characters.
323
324=end original
325
326C<eval> は文字列音内部エンコーディングに依存して異なる振る舞いを行い、
327時には引数をバイトの文字列として扱い、時には文字の文字列として扱います。
328
329=item *
330
331=begin original
332
333Source filters activated within C<eval> leak out into whichever I<file>
334scope is currently being compiled. To give an example with the CPAN module
335L<Semi::Semicolons>:
336
337=end original
338
339C<eval> の中で有効にされたソースフィルタは、どの I<file> スコープが
340コンパイルされているかについてリークします。
341CPAN モジュールである L<Semi::Semicolons> を例にします:
342
343 BEGIN { eval "use Semi::Semicolons; # not filtered here " }
344 # filtered here!
345
346=begin original
347
348C<evalbytes> fixes that to work the way one would expect:
349
350=end original
351
352C<evalbytes> は、想定通りに動作するように修正します:
353
354 use feature "evalbytes";
355 BEGIN { evalbytes "use Semi::Semicolons; # filtered " }
356 # not filtered
357
358=back
359
360=begin original
361
362These two features are available starting with Perl 5.16.
363
364=end original
365
366これら二つの機能は Perl 5.16 から利用可能です。
367
322368=head2 The 'current_sub' feature
323369
324370('current_sub' 機能)
325371
326372=begin original
327373
328374This provides the C<__SUB__> token that returns a reference to the current
329375subroutine or C<undef> outside of a subroutine.
330376
331377=end original
332378
333379これは C<__SUB__> トークンを提供します; これは現在のサブルーチンへの
334380リファレンスか、サブルーチンの外側では C<undef> を返します。
335381
336382=begin original
337383
338384This feature is available starting with Perl 5.16.
339385
340386=end original
341387
342388この機能は Perl 5.16 から利用可能です。
343389
344390=head2 The 'array_base' feature
345391
346392('array_base' 機能)
347393
348394=begin original
349395
350This feature supported the legacy C<$[> variable. See L<perlvar/$[>.
396This feature supports the legacy C<$[> variable. See L<perlvar/$[> and
351It was on by default but disabled under C<use v5.16> (see
397L<arybase>. It is on by default but disabled under C<use v5.16> (see
352L</IMPLICIT LOADING>, below) and unavailable since perl 5.30.
398L</IMPLICIT LOADING>, below).
353399
354400=end original
355401
356この機能はレガシーな C<$[> 変数に対応していした
402この機能はレガシーな C<$[> 変数に対応しま
357L<perlvar/$[> を参照してください。
403L<perlvar/$[> と L<arybase> を参照してください。
358これはデフォルトではオンでしたが C<use v5.16> (後述の
404これはデフォルトではオンでが C<use v5.16> (後述の
359L</IMPLICIT LOADING> 参照) のでは無効になっていて、
405L</IMPLICIT LOADING> 参照) のでは無効になります。
360perl 5.30 から利用できなくなりました。
361406
362407=begin original
363408
364409This feature is available under this name starting with Perl 5.16. In
365410previous versions, it was simply on all the time, and this pragma knew
366411nothing about it.
367412
368413=end original
369414
370415この機能は Perl 5.16 からこの名前で利用可能です。
371416以前のバージョンでは、単に常時適用されていて、このプラグマはこれについて
372417何も知りませんでした。
373418
374419=head2 The 'fc' feature
375420
376421('fc' 機能)
377422
378423=begin original
379424
380425C<use feature 'fc'> tells the compiler to enable the C<fc> function,
381426which implements Unicode casefolding.
382427
383428=end original
384429
385430C<use feature 'fc'> は、Unicode 畳み込みを実装した C<fc> 関数を
386431有効にするようにコンパイラに伝えます。
387432
388433=begin original
389434
390435See L<perlfunc/fc> for details.
391436
392437=end original
393438
394439詳しくは L<perlfunc/fc> を参照してください。
395440
396441=begin original
397442
398443This feature is available from Perl 5.16 onwards.
399444
400445=end original
401446
402447この機能は Perl 5.16 から利用可能です。
403448
404449=head2 The 'lexical_subs' feature
405450
406451('lexical_subs' 機能)
407452
408453=begin original
409454
410In Perl versions prior to 5.26, this feature enabled
455B<WARNING>: This feature is still experimental and the implementation may
411declaration of subroutines via C<my sub foo>, C<state sub foo>
456change in future versions of Perl. For this reason, Perl will
412and C<our sub foo> syntax. See L<perlsub/Lexical Subroutines> for details.
457warn when you use the feature, unless you have explicitly disabled the
458warning:
413459
414460=end original
415461
416Perl バージョン 5.26 より前の場合、これは
462B<警告>: この機能はまだ実験的で、実装は将来のバージョン Perl
417C<my sub foo>, C<state sub foo>, C<our sub foo> 文法によ
463変わかもしれません。
418サブルーチン定義効にします
464ため、この機能使うと、明示的に無効にしない限り警告が発生します:
419詳しくは L<perlsub/Lexical Subroutines> を参照してください。
420465
466 no warnings "experimental::lexical_subs";
467
421468=begin original
422469
423This feature is available from Perl 5.18 onwards. From Perl 5.18 to 5.24,
470This enables declaration of subroutines via C<my sub foo>, C<state sub foo>
424it was classed as experimental, and Perl emitted a warning for its
471and C<our sub foo> syntax. See L<perlsub/Lexical Subroutines> for details.
425usage, except when explicitly disabled:
426472
427473=end original
428474
429の機能Perl 5.18 から利用可能です。
475、C<my sub foo>, C<state sub foo>, C<our sub foo> 文法による
430Perl 5.18 から 5.24 では、これは実験的と位置づけられていて、
476サブルーチンの定義を有効にします。
431明示的に無効にない限り Perl は警告出力していました:
477くは L<perlsub/Lexical Subroutines> 参照してくださ
432478
433 no warnings "experimental::lexical_subs";
434
435479=begin original
436480
437As of Perl 5.26, use of this feature no longer triggers a warning, though
481This feature is available from Perl 5.18 onwards.
438the C<experimental::lexical_subs> warning category still exists (for
439compatibility with code that disables it). In addition, this syntax is
440not only no longer experimental, but it is enabled for all Perl code,
441regardless of what feature declarations are in scope.
442482
443483=end original
444484
445Perl 5.24 から、この機能の使はもはや警告を出力しなくなりましたが、
485この機能は Perl 5.18 から可能です。
446C<experimental::lexical_subs> 警告カテゴリは(これを無効にするコードとの
447互換性のために)存在するままです。
448さらにl、この文法はもはや実験的ではないだけでなく、
449どんな機能宣言がスコープ内にあるかに関わらず、
450全ての Perl コードで有効です。
451486
452487=head2 The 'postderef' and 'postderef_qq' features
453488
454489('postderef' と 'postderef_qq' 機能)
455490
456491=begin original
457492
458493The 'postderef_qq' feature extends the applicability of L<postfix
459494dereference syntax|perlref/Postfix Dereference Syntax> so that postfix array
460495and scalar dereference are available in double-quotish interpolations. For
461496example, it makes the following two statements equivalent:
462497
463498=end original
464499
465500'postderef_qq' 機能は、
466501L<後置デリファレンス文法|perlref/Postfix Dereference Syntax> の機能を、
467502後置配列と後置スカラのデリファレンスがダブルクォート風変数展開で
468503利用可能になるように拡張します。
469504例えば、次の二つの文が等価になります:
470505
471506 my $s = "[@{ $h->{a} }]";
472507 my $s = "[$h->{a}->@*]";
473508
474509=begin original
475510
476511This feature is available from Perl 5.20 onwards. In Perl 5.20 and 5.22, it
477512was classed as experimental, and Perl emitted a warning for its
478513usage, except when explicitly disabled:
479514
480515=end original
481516
482517この機能は Perl 5.20 から利用可能です。
483518Perl 5.20 と 5.22 では、これは実験的と位置づけられていて、
484519明示的に無効にしない限り Perl は警告を出力していました:
485520
486521 no warnings "experimental::postderef";
487522
488523=begin original
489524
490525As of Perl 5.24, use of this feature no longer triggers a warning, though
491526the C<experimental::postderef> warning category still exists (for
492527compatibility with code that disables it).
493528
494529=end original
495530
496531Perl 5.24 から、この機能の使用はもはや警告を出力しなくなりましたが、
497532C<experimental::postderef> 警告カテゴリは(これを無効にするコードとの
498533互換性のために)存在するままです。
499534
500535=begin original
501536
502537The 'postderef' feature was used in Perl 5.20 and Perl 5.22 to enable
503538postfix dereference syntax outside double-quotish interpolations. In those
504539versions, using it triggered the C<experimental::postderef> warning in the
505540same way as the 'postderef_qq' feature did. As of Perl 5.24, this syntax is
506541not only no longer experimental, but it is enabled for all Perl code,
507542regardless of what feature declarations are in scope.
508543
509544=end original
510545
511546'postderef' 機能は、ダブルクォート風変数展開の外側での
512547後置デリファレンス文法を有効にするために Perl 5.20 から Perl 5.22 で
513548使われていました。
514549これらのバージョンでは、'postderef_qq' 機能と同様に、これを使うと
515550C<experimental::postderef> 警告を引き起こします。
516551Perl 5.24 から、この文法はもはや実験的ではなくなっただけではなく、
517552スコープ中でどんな機能が宣言されているかに関わらず、全ての Perl コードで
518553有効になりました。
519554
520555=head2 The 'signatures' feature
521556
522557('signatures' 機能)
523558
524559=begin original
525560
526561B<WARNING>: This feature is still experimental and the implementation may
527562change in future versions of Perl. For this reason, Perl will
528563warn when you use the feature, unless you have explicitly disabled the
529564warning:
530565
531566=end original
532567
533568B<警告>: この機能はまだ実験的で、実装は将来のバージョンの Perl で
534569変わるかもしれません。
535570このため、この機能を使うと、明示的に無効にしない限り警告が発生します:
536571
537572 no warnings "experimental::signatures";
538573
539574=begin original
540575
541576This enables unpacking of subroutine arguments into lexical variables
542577by syntax such as
543578
544579=end original
545580
546581これは、次のような文法によってサブルーチンの引数をレキシカル変数に
547582展開できるようにします:
548583
549584 sub foo ($left, $right) {
550585 return $left + $right;
551586 }
552587
553588=begin original
554589
555590See L<perlsub/Signatures> for details.
556591
557592=end original
558593
559594詳しくは L<perlsub/Signatures> を参照してください。
560595
561596=begin original
562597
563598This feature is available from Perl 5.20 onwards.
564599
565600=end original
566601
567602この機能は Perl 5.20 から利用可能です。
568603
569604=head2 The 'refaliasing' feature
570605
571606('refaliasing' 機能)
572607
573608=begin original
574609
575610B<WARNING>: This feature is still experimental and the implementation may
576611change in future versions of Perl. For this reason, Perl will
577612warn when you use the feature, unless you have explicitly disabled the
578613warning:
579614
580615=end original
581616
582617B<警告>: この機能はまだ実験的で、実装は将来のバージョンの Perl で
583618変わるかもしれません。
584619このため、この機能を使うと、明示的に無効にしない限り警告が発生します:
585620
586621 no warnings "experimental::refaliasing";
587622
588623=begin original
589624
590625This enables aliasing via assignment to references:
591626
592627=end original
593628
594629これはリファレンスへの代入による別名化を有効にします:
595630
596631 \$a = \$b; # $a and $b now point to the same scalar
597632 \@a = \@b; # to the same array
598633 \%a = \%b;
599634 \&a = \&b;
600635 foreach \%hash (@array_of_hash_refs) {
601636 ...
602637 }
603638
604639=begin original
605640
606641See L<perlref/Assigning to References> for details.
607642
608643=end original
609644
610645詳しくは L<perlref/Assigning to References> を参照してください。
611646
612647=begin original
613648
614649This feature is available from Perl 5.22 onwards.
615650
616651=end original
617652
618653この機能は Perl 5.22 から利用可能です。
619654
620655=head2 The 'bitwise' feature
621656
622657('bitwise' 機能)
623658
624659=begin original
625660
661B<WARNING>: This feature is still experimental and the implementation may
662change in future versions of Perl. For this reason, Perl will
663warn when you use the feature, unless you have explicitly disabled the
664warning:
665
666=end original
667
668B<警告>: この機能はまだ実験的で、実装は将来のバージョンの Perl で
669変わるかもしれません。
670このため、この機能を使うと、明示的に無効にしない限り警告が発生します:
671
672 no warnings "experimental::bitwise";
673
674=begin original
675
626676This makes the four standard bitwise operators (C<& | ^ ~>) treat their
627677operands consistently as numbers, and introduces four new dotted operators
628678(C<&. |. ^. ~.>) that treat their operands consistently as strings. The
629679same applies to the assignment variants (C<&= |= ^= &.= |.= ^.=>).
630680
631681=end original
632682
633683これは四つの標準ビット単位演算子 (C<& | ^ ~>) がそのオペランドを
634684数値として一貫して扱うようになり、
635685オペランドを一貫して文字列として扱う新しいドット付き演算子
636686(C<&. |. ^. ~.>) を導入します。
637687同じものは代入の亜種 (C<&= |= ^= &.= |.= ^.=>) にも適用されます。
638688
639689=begin original
640690
641691See L<perlop/Bitwise String Operators> for details.
642692
643693=end original
644694
645695詳しくは L<perlop/Bitwise String Operators> を参照してください。
646696
647697=begin original
648698
649This feature is available from Perl 5.22 onwards. Starting in Perl 5.28,
699This feature is available from Perl 5.22 onwards.
650C<use v5.28> will enable the feature. Before 5.28, it was still
651experimental and would emit a warning in the "experimental::bitwise"
652category.
653700
654701=end original
655702
656703この機能は Perl 5.22 から利用可能です。
657Perl 5.28 から、C<use v5.28> はこの機能を有効にします。
6585.28 より前では、これはまだ実験的で、
659"experimental::bitwise" カテゴリの警告が出力されます。
660704
661=head2 The 'declared_refs' feature
662
663('declared_refs' 機能)
664
665=begin original
666
667B<WARNING>: This feature is still experimental and the implementation may
668change in future versions of Perl. For this reason, Perl will
669warn when you use the feature, unless you have explicitly disabled the
670warning:
671
672=end original
673
674B<警告>: この機能はまだ実験的で、実装は将来のバージョンの Perl で
675変わるかもしれません。
676このため、この機能を使うと、明示的に無効にしない限り警告が発生します:
677
678 no warnings "experimental::declared_refs";
679
680=begin original
681
682This allows a reference to a variable to be declared with C<my>, C<state>,
683our C<our>, or localized with C<local>. It is intended mainly for use in
684conjunction with the "refaliasing" feature. See L<perlref/Declaring a
685Reference to a Variable> for examples.
686
687=end original
688
689これは C<my>, C<state>, C<our>, C<local> でのローカル化において、
690変数へのリファレンスを宣言できるようになります。
691これは主に "refaliasing" 機能と併せて使うことを意図しています。
692例については L<perlref/Declaring a Reference to a Variable> を
693参照してください。
694
695=begin original
696
697This feature is available from Perl 5.26 onwards.
698
699=end original
700
701この機能は Perl 5.26 から利用可能です。
702
703705=head1 FEATURE BUNDLES
704706
705707(機能の束)
706708
707709=begin original
708710
709711It's possible to load multiple features together, using
710712a I<feature bundle>. The name of a feature bundle is prefixed with
711713a colon, to distinguish it from an actual feature.
712714
713715=end original
714716
715717複数の機能のまとめて読み込むためには、I<機能の束> (feature bundle) が
716718使えます。
717719機能の束の名前には、実際の機能と区別するためにコロンが前置されます。
718720
719721 use feature ":5.10";
720722
721723=begin original
722724
723725The following feature bundles are available:
724726
725727=end original
726728
727729以下の機能の束が利用可能です:
728730
729=begin original
730
731731 bundle features included
732732 --------- -----------------
733 :default
733 :default array_base
734734
735=end original
735 :5.10 say state switch array_base
736736
737 含まれる機能
737 :5.12 say state switch unicode_strings array_base
738 --------- -----------------
739 :default
740738
741 :5.10 say state switch
739 :5.14 say state switch unicode_strings array_base
742740
743 :5.12 say state switch unicode_strings
744
745 :5.14 say state switch unicode_strings
746
747741 :5.16 say state switch unicode_strings
748742 unicode_eval evalbytes current_sub fc
749743
750744 :5.18 say state switch unicode_strings
751745 unicode_eval evalbytes current_sub fc
752746
753747 :5.20 say state switch unicode_strings
754748 unicode_eval evalbytes current_sub fc
755749
756750 :5.22 say state switch unicode_strings
757751 unicode_eval evalbytes current_sub fc
758752
759753 :5.24 say state switch unicode_strings
760754 unicode_eval evalbytes current_sub fc
761755 postderef_qq
762756
763 :5.26 say state switch unicode_strings
764 unicode_eval evalbytes current_sub fc
765 postderef_qq
766
767 :5.28 say state switch unicode_strings
768 unicode_eval evalbytes current_sub fc
769 postderef_qq bitwise
770
771 :5.30 say state switch unicode_strings
772 unicode_eval evalbytes current_sub fc
773 postderef_qq bitwise
774
775757=begin original
776758
777759The C<:default> bundle represents the feature set that is enabled before
778760any C<use feature> or C<no feature> declaration.
779761
780762=end original
781763
782764C<:default> 束は、C<use feature> や C<no feature> 宣言が有効になる前の
783765機能集合を表現しています。
784766
785767=begin original
786768
787769Specifying sub-versions such as the C<0> in C<5.14.0> in feature bundles has
788770no effect. Feature bundles are guaranteed to be the same for all sub-versions.
789771
790772=end original
791773
792774機能の束での C<5.14.0> の C<0> のような副バージョンを指定しても効果は
793775ありません。
794776機能の束は全ての副バージョンに関して同じ事が保証されています。
795777
796778 use feature ":5.14.0"; # same as ":5.14"
797779 use feature ":5.14.1"; # same as ":5.14"
798780
799781=head1 IMPLICIT LOADING
800782
801783(暗黙の読み込み)
802784
803785=begin original
804786
805787Instead of loading feature bundles by name, it is easier to let Perl do
806788implicit loading of a feature bundle for you.
807789
808790=end original
809791
810792機能の束を名前で読み込むより、Perl に機能の束を暗黙に読み込ませるように
811793した方が簡単です。
812794
813795=begin original
814796
815797There are two ways to load the C<feature> pragma implicitly:
816798
817799=end original
818800
819801C<feature> プラグマを暗黙に読み込むには二つの方法があります:
820802
821803=over 4
822804
823805=item *
824806
825807=begin original
826808
827809By using the C<-E> switch on the Perl command-line instead of C<-e>.
828810That will enable the feature bundle for that version of Perl in the
829811main compilation unit (that is, the one-liner that follows C<-E>).
830812
831813=end original
832814
833815Perl のコマンドラインで C<-e> オプションの代わりに C<-E> オプションを
834816使用した場合。
835817これにより、main コンパイル単位(つまり、C<-E> に引き続く 1 行野郎)で
836818そのバージョンの Perl の機能の束が有効になります。
837819
838820=item *
839821
840822=begin original
841823
842824By explicitly requiring a minimum Perl version number for your program, with
843825the C<use VERSION> construct. That is,
844826
845827=end original
846828
847829C<use VERSION> 構文を使ってプログラムが必要とする最低限の Perl バージョン
848830番号を明示的に指定した場合。
849831つまり、以下のようにすると:
850832
851833 use v5.10.0;
852834
853835=begin original
854836
855837will do an implicit
856838
857839=end original
858840
859841暗黙のうちに以下のように:
860842
861843 no feature ':all';
862844 use feature ':5.10';
863845
864846=begin original
865847
866848and so on. Note how the trailing sub-version
867849is automatically stripped from the
868850version.
869851
870852=end original
871853
872854なるということです。
873855末尾の副バージョンは自動的にバージョンから取り除かれるようになったことに
874856注意してください。
875857
876858=begin original
877859
878860But to avoid portability warnings (see L<perlfunc/use>), you may prefer:
879861
880862=end original
881863
882864しかし移植性の警告(L<perlfunc/use> を参照してください)を避けるために、
883865以下のようにするのを好むかもしれません:
884866
885867 use 5.010;
886868
887869=begin original
888870
889871with the same effect.
890872
891873=end original
892874
893875これでも同じ効果が得られます。
894876
895877=begin original
896878
897879If the required version is older than Perl 5.10, the ":default" feature
898880bundle is automatically loaded instead.
899881
900882=end original
901883
902884要求したバージョンが Perl 5.10 より前の場合、代わりに機能の束 ":default" が
903885自動的に読み込まれます。
904
905=begin original
906
907Unlike C<use feature ":5.12">, saying C<use v5.12> (or any higher version)
908also does the equivalent of C<use strict>; see L<perlfunc/use> for details.
909
910=end original
911
912C<use feature ":5.12"> と異なり、C<use v5.12> (またはそれ以上) とすると、
913C<use strict> と等価なことを行います;
914詳しくは L<perlfunc/use> を参照してください。
915886
916887=back
917888
918889=cut
919890
920891=begin meta
921892
922893Translate: SHIRAKATA Kentaro <argrath@ub32.org>
923894Status: completed
924895
925896=end meta