Date: Thursday December 26, 2019 @ 21:20 Author: argrath Update of /cvsroot/perldocjp/docs/modules/feature-1.36 In directory sf-cvs:/tmp/cvs-serv74832/modules/feature-1.36 Added Files: feature.pod Log Message: feature-1.36 =================================================================== File: feature.pod Status: Up-to-date Working revision: 1.1 Thu Dec 26 12:20:04 2019 Repository revision: 1.1 /cvsroot/perldocjp/docs/modules/feature-1.36/feature.pod,v Existing Tags: No Tags Exist -------------- next part -------------- Index: docs/modules/feature-1.36/feature.pod diff -u /dev/null docs/modules/feature-1.36/feature.pod:1.1 --- /dev/null Thu Dec 26 21:20:04 2019 +++ docs/modules/feature-1.36/feature.pod Thu Dec 26 21:20:04 2019 @@ -0,0 +1,709 @@ + +=encoding euc-jp + +=head1 NAME + +=begin original + +feature - Perl pragma to enable new features + +=end original + +feature - ¿·¤·¤¤µ¡Ç½¤ò͸ú¤Ë¤¹¤ë¥×¥é¥°¥Þ + +=head1 SYNOPSIS + + use feature qw(say switch); + given ($foo) { + when (1) { say "\$foo == 1" } + when ([2,3]) { say "\$foo == 2 || \$foo == 3" } + when (/^a[bc]d$/) { say "\$foo eq 'abd' || \$foo eq 'acd'" } + when ($_ > 100) { say "\$foo > 100" } + default { say "None of the above" } + } + + use feature ':5.10'; # loads all features available in perl 5.10 + + use v5.10; # implicitly loads :5.10 feature bundle + +=head1 DESCRIPTION + +=begin original + +It is usually impossible to add new syntax to Perl without breaking +some existing programs. This pragma provides a way to minimize that +risk. New syntactic constructs, or new semantic meanings to older +constructs, can be enabled by C<use feature 'foo'>, and will be parsed +only when the appropriate feature pragma is in scope. (Nevertheless, the +C<CORE::> prefix provides access to all Perl keywords, regardless of this +pragma.) + +=end original + +´û¤Ë¸ºß¤·¤Æ¤¤¤ë¥×¥í¥°¥é¥à¤ò²õ¤¹¤³¤È¤Ê¤¯¡¢Perl ¤Ë¿·¤·¤¤Ê¸Ë¡¤òÄɲ乤뤳¤È¤Ï¡¢ +ÉáÄ̤ÏÉÔ²Äǽ¤Ç¤¹¡£ +¤³¤Î¥×¥é¥°¥Þ¤Ï¡¢¥ê¥¹¥¯¤òºÇ¾®²½¤¹¤ëÊýË¡¤òÄ󶡤·¤Þ¤¹¡£ +¿·¤·¤¤Ê¸Ë¡¹½Â¤¤ä¡¢¸Å¤¤¹½Â¤¤Î¿·¤·¤¤°ÕÌ£¤Ï¡¢C<use feature 'foo'> ¤Ç͸ú²½¤µ¤ì¡¢ +ŬÀÚ¤Ê feature ¥×¥é¥°¥Þ¤¬¥¹¥³¡¼¥×Æâ¤Ë¤¢¤ë¾ì¹ç¤Ë¤Î¤ß¥Ñ¡¼¥¹¤µ¤ì¤Þ¤¹¡£ +(¤½¤ì¤Ç¤â¡¢¤³¤Î¥×¥é¥°¥Þ¤Ë´Ø¤ï¤é¤º¡¢C<CORE::> ÀÜƬ¼¤ÏÁ´¤Æ¤Î +Perl ¥¡¼¥ï¡¼¥É¤Ø¤Î¥¢¥¯¥»¥¹¤òÄ󶡤·¤Þ¤¹¡£) + +=head2 Lexical effect + +(¥ì¥¥·¥«¥ë¤Ê¸ú²Ì) + +=begin original + +Like other pragmas (C<use strict>, for example), features have a lexical +effect. C<use feature qw(foo)> will only make the feature "foo" available +from that point to the end of the enclosing block. + +=end original + +(Î㤨¤Ð C<use strict> ¤Î¤è¤¦¤Ê) ¤½¤Î¾¤Î¥×¥é¥°¥Þ¤ÈƱÍÍ¡¢feature ¤Ï +¥ì¥¥·¥«¥ë¤Ê¸ú²Ì¤ò»ý¤Á¤Þ¤¹¡£ +C<use feature qw(foo)> ¤Ï¡¢¤³¤ÎÃÏÅÀ¤«¤é¥Ö¥í¥Ã¥¯¤Î½ª¤ï¤ê¤Þ¤Ç¤Î´Ö¤À¤±¡¢ +"foo" µ¡Ç½¤òÍøÍѲÄǽ¤Ë¤·¤Þ¤¹¡£ + + { + use feature 'say'; + say "say is available here"; + } + print "But not here.\n"; + +=head2 C<no feature> + +=begin original + +Features can also be turned off by using C<no feature "foo">. This too +has lexical effect. + +=end original + +µ¡Ç½¤Ï C<no feature "foo"> ¤ò»È¤¦¤³¤È¤Ç̵¸ú¤Ë¤¹¤ë¤³¤È¤â½ÐÍè¤Þ¤¹¡£ +¤³¤ì¤â¤Þ¤¿¥ì¥¥·¥«¥ë¤Ê¸ú²Ì¤ò»ý¤Á¤Þ¤¹¡£ + + use feature 'say'; + say "say is available here"; + { + no feature 'say'; + print "But not here.\n"; + } + say "Yet it is here."; + +=begin original + +C<no feature> with no features specified will reset to the default group. To +disable I<all> features (an unusual request!) use C<no feature ':all'>. + +=end original + +C<no feature> ¤È¡¢µ¡Ç½¤ò»ØÄꤻ¤º¤Ë»È¤¦¤È¡¢¥Ç¥Õ¥©¥ë¥È¥°¥ë¡¼¥×¤Ë¥ê¥»¥Ã¥È¤·¤Þ¤¹¡£ +I<Á´¤Æ¤Î> µ¡Ç½¤ò̵¸ú¤Ë¤¹¤ë(ÉáÄ̤Ǥʤ¤Í×µá!)¤Ë¤Ï¡¢C<no feature ':all'> ¤ò +»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£ + +=head1 AVAILABLE FEATURES + +(ÍøÍѲÄǽ¤Êµ¡Ç½) + +=head2 The 'say' feature + +('say' µ¡Ç½) + +=begin original + +C<use feature 'say'> tells the compiler to enable the Perl 6 style +C<say> function. + +=end original + +C<use feature 'say'> ¤Ï¡¢¥³¥ó¥Ñ¥¤¥é¤Ë Perl 6 ·Á¼°¤Î C<say> ´Ø¿ô¤ò +͸ú¤Ë¤¹¤ë¤è¤¦¤ËÅÁ¤¨¤Þ¤¹¡£ + +=begin original + +See L<perlfunc/say> for details. + +=end original + +¾Ü¤·¤¯¤Ï L<perlfunc/say> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ + +=begin original + +This feature is available starting with Perl 5.10. + +=end original + +¤³¤Îµ¡Ç½¤Ï Perl 5.10 ¤«¤éÍøÍѲÄǽ¤Ç¤¹¡£ + +=head2 The 'state' feature + +('state' µ¡Ç½) + +=begin original + +C<use feature 'state'> tells the compiler to enable C<state> +variables. + +=end original + +C<use feature 'state'> ¤Ï¡¢¥³¥ó¥Ñ¥¤¥é¤Ë C<state> ÊÑ¿ô¤ò͸ú¤Ë¤¹¤ë¤è¤¦¤Ë +ÅÁ¤¨¤Þ¤¹¡£ + +=begin original + +See L<perlsub/"Persistent Private Variables"> for details. + +=end original + +¾Ü¤·¤¯¤Ï L<perlsub/"Persistent Private Variables"> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ + +=begin original + +This feature is available starting with Perl 5.10. + +=end original + +¤³¤Îµ¡Ç½¤Ï Perl 5.10 ¤«¤éÍøÍѲÄǽ¤Ç¤¹¡£ + +=head2 The 'switch' feature + +('switch' µ¡Ç½) + +=begin original + +C<use feature 'switch'> tells the compiler to enable the Perl 6 +given/when construct. + +=end original + +C<use feature 'switch'> ¤Ï¡¢¥³¥ó¥Ñ¥¤¥é¤Ë Perl 6 given/when ¹½Ê¸¤ò +͸ú¤Ë¤¹¤ë¤è¤¦¤ËÅÁ¤¨¤Þ¤¹¡£ + +=begin original + +See L<perlsyn/"Switch Statements"> for details. + +=end original + +¾Ü¤·¤¯¤Ï L<perlsyn/"Switch Statements"> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ + +=begin original + +This feature is available starting with Perl 5.10. + +=end original + +¤³¤Îµ¡Ç½¤Ï Perl 5.10 ¤«¤éÍøÍѲÄǽ¤Ç¤¹¡£ + +=head2 The 'unicode_strings' feature + +('unicode_strings' µ¡Ç½) + +=begin original + +C<use feature 'unicode_strings'> tells the compiler to use Unicode rules +in all string operations executed within its scope (unless they are also +within the scope of either C<use locale> or C<use bytes>). The same applies +to all regular expressions compiled within the scope, even if executed outside +it. It does not change the internal representation of strings, but only how +they are interpreted. + +=end original + +C<use feature 'unicode_strings'> ¤Ï¡¢(C<use locale> ¤« C<use bytes> ¤Î +¥¹¥³¡¼¥×¤Ê¤¤¤Ç¤Ê¤¤¸Â¤ê) ¤½¤Î¥¹¥³¡¼¥×Æâ¤Ç¼Â¹Ô¤µ¤ì¤ëÁ´¤Æ¤Îʸ»úÎóÁàºî¤Ë +Unicode ¤Îµ¬Â§¤ò»È¤¦¤è¤¦¤Ë¥³¥ó¥Ñ¥¤¥é¤ËÅÁ¤¨¤Þ¤¹¡£ +¤³¤ì¤Ïʸ»úÎó¤ÎÆâÉôɽ¸½¤ÏÊѹ¹¤·¤Þ¤»¤ó; ¤½¤ì¤ò¤É¤¦²ò¼á¤¹¤ë¤«¤À¤±¤Ç¤¹¡£ + +=begin original + +C<no feature 'unicode_strings'> tells the compiler to use the traditional +Perl rules wherein the native character set rules is used unless it is +clear to Perl that Unicode is desired. This can lead to some surprises +when the behavior suddenly changes. (See +L<perlunicode/The "Unicode Bug"> for details.) For this reason, if you are +potentially using Unicode in your program, the +C<use feature 'unicode_strings'> subpragma is B<strongly> recommended. + +=end original + +C<no feature 'unicode_strings'> ¤Ï¡¢Unicode ¤¬µá¤á¤é¤ì¤Æ¤¤¤ë¤Î¤¬ +Perl ¤Ë¤È¤Ã¤ÆÌÀ¤é¤«¤Ç¤Ê¤¤¸Â¤ê¡¢¥Í¥¤¥Æ¥£¥Ö¤Êʸ»ú½¸¹çµ¬Â§¤¬»È¤ï¤ì¤ë¤È¤³¤í¤Ç +ÅÁÅýŪ¤Ê Perl ¤Îµ¬Â§¤ò»È¤¦¤è¤¦¤Ë¥³¥ó¥Ñ¥¤¥é¤ËÅÁ¤¨¤Þ¤¹¡£ +¤³¤ì¤Ï¡¢¿¶¤ëÉñ¤¤¤¬ÆÍÁ³Êѹ¹¤µ¤ì¤¿¤È¤¤Ë¶Ã¤¤ò°ú¤µ¯¤³¤¹¤«¤â¤·¤ì¤Þ¤»¤ó¡£ +(¾Ü¤·¤¯¤Ï L<perlunicode/The "Unicode Bug"> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£) +¤³¤ÎÍýͳ¤Ë¤è¤ê¡¢¤â¤·¥×¥í¥°¥é¥à¤Ç Unicode ¤ò°·¤¦²ÄǽÀ¤¬¤¢¤ë¤Ê¤é¡¢ +C<use feature 'unicode_strings'> Éû¥×¥é¥°¥Þ¤ò B<¶¯¤¯> ´«¤á¤Þ¤¹¡£ + +=begin original + +This feature is available starting with Perl 5.12; was almost fully +implemented in Perl 5.14; and extended in Perl 5.16 to cover C<quotemeta>. + +=end original + +¤³¤Îµ¡Ç½¤Ï Perl 5.12 ¤«¤éÍøÍѲÄǽ¤Ë¤Ê¤ê¤Þ¤·¤¿; Perl 5.14 ¤Ç¤Û¤Ü´°Á´¤Ë +¼ÂÁõ¤µ¤ì¤Þ¤·¤¿; Perl 5.16 ¤Ç C<quotemeta> ¤ËÂбþ¤¹¤ë¤è¤¦¤Ë³ÈÄ¥¤µ¤ì¤Þ¤·¤¿¡£ + +=head2 The 'unicode_eval' and 'evalbytes' features + +('unicode_eval' ¤È 'evalbytes' µ¡Ç½) + +=begin original + +Under the C<unicode_eval> feature, Perl's C<eval> function, when passed a +string, will evaluate it as a string of characters, ignoring any +C<use utf8> declarations. C<use utf8> exists to declare the encoding of +the script, which only makes sense for a stream of bytes, not a string of +characters. Source filters are forbidden, as they also really only make +sense on strings of bytes. Any attempt to activate a source filter will +result in an error. + +=end original + +C<unicode_eval> µ¡Ç½¤Î´ð¤Ç¤Ï¡¢Perl ¤Î C<eval> ´Ø¿ô¤Ëʸ»úÎó¤¬ÅϤµ¤ì¤ë¤È¡¢ +ʸ»ú¤Îʸ»úÎó¤È¤·¤Æɾ²Á¤·¡¢C<use utf8> Àë¸À¤ò̵»ë¤·¤Þ¤¹¡£ +C<use utf8> ¤Ï¥¹¥¯¥ê¥×¥È¤Î¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤òÀë¸À¤¹¤ë¤¿¤á¤Ë¸ºß¤·¡¢ +¥Ð¥¤¥È¤ÎʤӤˤΤ߰ÕÌ£¤¬¤¢¤ê¡¢Ê¸»ú¤Îʸ»úÎó¤Ç¤Ï°ÕÌ£¤¬¤¢¤ê¤Þ¤»¤ó¡£ +¥½¡¼¥¹¥Õ¥£¥ë¥¿¤Ï¶Ø»ß¤µ¤ì¤Þ¤¹; ¤³¤ì¤é¤â¥Ð¥¤¥È¤Îʸ»úÎó¤ËÂФ·¤Æ¤Î¤ß +°ÕÌ£¤¬¤¢¤ë¤«¤é¤Ç¤¹¡£ +¥½¡¼¥¹¥Õ¥£¥ë¥¿¤ò͸ú¤Ë¤·¤è¤¦¤È¤¹¤ë¤¢¤é¤æ¤ë»î¤ß¤Ï¥¨¥é¡¼¤È¤Ê¤ê¤Þ¤¹¡£ + +=begin original + +The C<evalbytes> feature enables the C<evalbytes> keyword, which evaluates +the argument passed to it as a string of bytes. It dies if the string +contains any characters outside the 8-bit range. Source filters work +within C<evalbytes>: they apply to the contents of the string being +evaluated. + +=end original + +C<evalbytes> µ¡Ç½¤Ï C<evalbytes> ¥¡¼¥ï¡¼¥É¤ò͸ú¤Ë¤·¤Þ¤¹; +¤³¤ì¤Ï°ú¿ô¤È¤·¤ÆÅϤµ¤ì¤¿¤â¤Î¤ò¥Ð¥¤¥È¤Îʸ»úÎó¤È¤·¤Æɾ²Á¤·¤Þ¤¹¡£ +ʸ»úÎó¤Ë 8 ¥Ó¥Ã¥È¤ÎÈϰϤγ°Â¦¤Îʸ»ú¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¤È die ¤·¤Þ¤¹¡£ +¥½¡¼¥¹¥Õ¥£¥ë¥¿¤Ï C<evalbytes> ¤ÎÃæ¤Ç¤ÏÆ°ºî¤·¤Þ¤¹: ¤³¤ì¤é¤Ï +ɾ²Á¤µ¤ì¤ëʸ»úÎó¤ÎÃæ¿È¤ËÂФ·¤ÆŬÍѤµ¤ì¤Þ¤¹¡£ + +=begin original + +Together, these two features are intended to replace the historical C<eval> +function, which has (at least) two bugs in it, that cannot easily be fixed +without breaking existing programs: + +=end original + +¤³¤ì¤éÆó¤Ä¤Îµ¡Ç½¤Ï¶¦¤Ë¡¢Îò»ËŪ¤Ê C<eval> ´Ø¿ô¤òÃÖ¤´¹¤¨¤ë¤³¤È¤ò +ÌÜŪ¤È¤·¤Æ¤¤¤Þ¤¹; ¤³¤ì¤Ë¤Ï(¾¯¤Ê¤¯¤È¤â)Æó¤Ä¤Î¥Ð¥°¤¬¤¢¤ê¡¢´û¸¤Î¥×¥í¥°¥é¥à¤ò +²õ¤¹¤³¤È¤Ê¤¯´Êñ¤Ë½¤Àµ¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤»¤ó: + +=over + +=item * + +=begin original + +C<eval> behaves differently depending on the internal encoding of the +string, sometimes treating its argument as a string of bytes, and sometimes +as a string of characters. + +=end original + +C<eval> ¤Ïʸ»úÎó²»ÆâÉô¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤Ë°Í¸¤·¤Æ°Û¤Ê¤ë¿¶¤ëÉñ¤¤¤ò¹Ô¤¤¡¢ +»þ¤Ë¤Ï°ú¿ô¤ò¥Ð¥¤¥È¤Îʸ»úÎó¤È¤·¤Æ°·¤¤¡¢»þ¤Ë¤Ïʸ»ú¤Îʸ»úÎó¤È¤·¤Æ°·¤¤¤Þ¤¹¡£ + +=item * + +=begin original + +Source filters activated within C<eval> leak out into whichever I<file> +scope is currently being compiled. To give an example with the CPAN module +L<Semi::Semicolons>: + +=end original + +Source filters activated within +C<eval> ¤ÎÃæ¤Ç͸ú¤Ë¤µ¤ì¤¿¥½¡¼¥¹¥Õ¥£¥ë¥¿¤Ï¡¢¤É¤Î I<file> ¥¹¥³¡¼¥×¤¬ +¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Æ¤¤¤ë¤«¤Ë¤Ä¤¤¤Æ¥ê¡¼¥¯¤·¤Þ¤¹¡£ +CPAN ¥â¥¸¥å¡¼¥ë¤Ç¤¢¤ë L<Semi::Semicolons> ¤òÎã¤Ë¤·¤Þ¤¹: + + BEGIN { eval "use Semi::Semicolons; # not filtered here " } + # filtered here! + +=begin original + +C<evalbytes> fixes that to work the way one would expect: + +=end original + +C<evalbytes> ¤Ï¡¢ÁÛÄêÄ̤ê¤ËÆ°ºî¤¹¤ë¤è¤¦¤Ë½¤Àµ¤·¤Þ¤¹: + + use feature "evalbytes"; + BEGIN { evalbytes "use Semi::Semicolons; # filtered " } + # not filtered + +=back + +=begin original + +These two features are available starting with Perl 5.16. + +=end original + +¤³¤ì¤éÆó¤Ä¤Îµ¡Ç½¤Ï Perl 5.16 ¤«¤éÍøÍѲÄǽ¤Ç¤¹¡£ + +=head2 The 'current_sub' feature + +('current_sub' µ¡Ç½) + +=begin original + +This provides the C<__SUB__> token that returns a reference to the current +subroutine or C<undef> outside of a subroutine. + +=end original + +¤³¤ì¤Ï C<__SUB__> ¥È¡¼¥¯¥ó¤òÄ󶡤·¤Þ¤¹; ¤³¤ì¤Ï¸½ºß¤Î¥µ¥Ö¥ë¡¼¥Á¥ó¤Ø¤Î +¥ê¥Õ¥¡¥ì¥ó¥¹¤«¡¢¥µ¥Ö¥ë¡¼¥Á¥ó¤Î³°Â¦¤Ç¤Ï C<undef> ¤òÊÖ¤·¤Þ¤¹¡£ + +=begin original + +This feature is available starting with Perl 5.16. + +=end original + +¤³¤Îµ¡Ç½¤Ï Perl 5.16 ¤«¤éÍøÍѲÄǽ¤Ç¤¹¡£ + +=head2 The 'array_base' feature + +('array_base' µ¡Ç½) + +=begin original + +This feature supports the legacy C<$[> variable. See L<perlvar/$[> and +L<arybase>. It is on by default but disabled under C<use v5.16> (see +L</IMPLICIT LOADING>, below). + +=end original + +¤³¤Îµ¡Ç½¤Ï¥ì¥¬¥·¡¼¤Ê C<$[> ÊÑ¿ô¤ËÂбþ¤·¤Þ¤¹¡£ +L<perlvar/$[> ¤È L<arybase> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ +¤³¤ì¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥ª¥ó¤Ç¤¹¤¬ C<use v5.16> (¸å½Ò¤Î +L</IMPLICIT LOADING> »²¾È) ¤Î´ð¤Ç¤Ï̵¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£ + +=begin original + +This feature is available under this name starting with Perl 5.16. In +previous versions, it was simply on all the time, and this pragma knew +nothing about it. + +=end original + +¤³¤Îµ¡Ç½¤Ï Perl 5.16 ¤«¤é¤³¤Î̾Á°¤ÇÍøÍѲÄǽ¤Ç¤¹¡£ +°ÊÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¡¢Ã±¤Ë¾ï»þŬÍѤµ¤ì¤Æ¤¤¤Æ¡¢¤³¤Î¥×¥é¥°¥Þ¤Ï¤³¤ì¤Ë¤Ä¤¤¤Æ +²¿¤âÃΤê¤Þ¤»¤ó¤Ç¤·¤¿¡£ + +=head2 The 'fc' feature + +('fc' µ¡Ç½) + +=begin original + +C<use feature 'fc'> tells the compiler to enable the C<fc> function, +which implements Unicode casefolding. + +=end original + +C<use feature 'fc'> ¤Ï¡¢Unicode ¾ö¤ß¹þ¤ß¤ò¼ÂÁõ¤·¤¿ C<fc> ´Ø¿ô¤ò +͸ú¤Ë¤¹¤ë¤è¤¦¤Ë¥³¥ó¥Ñ¥¤¥é¤ËÅÁ¤¨¤Þ¤¹¡£ + +=begin original + +See L<perlfunc/fc> for details. + +=end original + +¾Ü¤·¤¯¤Ï L<perlfunc/fc> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ + +=begin original + +This feature is available from Perl 5.16 onwards. + +=end original + +¤³¤Îµ¡Ç½¤Ï Perl 5.16 ¤«¤éÍøÍѲÄǽ¤Ç¤¹¡£ + +=head2 The 'lexical_subs' feature + +('lexical_subs' µ¡Ç½) + +=begin original + +B<WARNING>: This feature is still experimental and the implementation may +change in future versions of Perl. For this reason, Perl will +warn when you use the feature, unless you have explicitly disabled the +warning: + +=end original + +B<·Ù¹ð>: ¤³¤Îµ¡Ç½¤Ï¤Þ¤À¼Â¸³Åª¤Ç¡¢¼ÂÁõ¤Ï¾Íè¤Î¥Ð¡¼¥¸¥ç¥ó¤Î Perl ¤Ç +ÊѤï¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£ +¤³¤Î¤¿¤á¡¢¤³¤Îµ¡Ç½¤ò»È¤¦¤È¡¢ÌÀ¼¨Åª¤Ë̵¸ú¤Ë¤·¤Ê¤¤¸Â¤ê·Ù¹ð¤¬È¯À¸¤·¤Þ¤¹: + + no warnings "experimental::lexical_subs"; + +=begin original + +This enables declaration of subroutines via C<my sub foo>, C<state sub foo> +and C<our sub foo> syntax. See L<perlsub/Lexical Subroutines> for details. + +=end original + +¤³¤ì¤Ï¡¢C<my sub foo>, C<state sub foo>, C<our sub foo> ʸˡ¤Ë¤è¤ë +¥µ¥Ö¥ë¡¼¥Á¥ó¤ÎÄêµÁ¤ò͸ú¤Ë¤·¤Þ¤¹¡£ +¾Ü¤·¤¯¤Ï L<perlsub/Lexical Subroutines> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ + +=begin original + +This feature is available from Perl 5.18 onwards. + +=end original + +¤³¤Îµ¡Ç½¤Ï Perl 5.18 ¤«¤éÍøÍѲÄǽ¤Ç¤¹¡£ + +=head2 The 'signatures' feature + +('signatures' µ¡Ç½) + +=begin original + +B<WARNING>: This feature is still experimental and the implementation may +change in future versions of Perl. For this reason, Perl will +warn when you use the feature, unless you have explicitly disabled the +warning: + +=end original + +B<·Ù¹ð>: ¤³¤Îµ¡Ç½¤Ï¤Þ¤À¼Â¸³Åª¤Ç¡¢¼ÂÁõ¤Ï¾Íè¤Î¥Ð¡¼¥¸¥ç¥ó¤Î Perl ¤Ç +ÊѤï¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£ +¤³¤Î¤¿¤á¡¢¤³¤Îµ¡Ç½¤ò»È¤¦¤È¡¢ÌÀ¼¨Åª¤Ë̵¸ú¤Ë¤·¤Ê¤¤¸Â¤ê·Ù¹ð¤¬È¯À¸¤·¤Þ¤¹: + + no warnings "experimental::signatures"; + +=begin original + +This enables unpacking of subroutine arguments into lexical variables +by syntax such as + +=end original + +¤³¤ì¤Ï¡¢¼¡¤Î¤è¤¦¤Êʸˡ¤Ë¤è¤Ã¤Æ¥µ¥Ö¥ë¡¼¥Á¥ó¤Î°ú¿ô¤ò¥ì¥¥·¥«¥ëÊÑ¿ô¤Ë +Ÿ³«¤Ç¤¤ë¤è¤¦¤Ë¤·¤Þ¤¹: + + sub foo ($left, $right) { + return $left + $right; + } + +=begin original + +See L<perlsub/Signatures> for details. + +=end original + +¾Ü¤·¤¯¤Ï L<perlsub/Signatures> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ + +=begin original + +This feature is available from Perl 5.20 onwards. + +=end original + +¤³¤Îµ¡Ç½¤Ï Perl 5.20 ¤«¤éÍøÍѲÄǽ¤Ç¤¹¡£ + +=head1 FEATURE BUNDLES + +(µ¡Ç½¤Î«) + +=begin original + +It's possible to load multiple features together, using +a I<feature bundle>. The name of a feature bundle is prefixed with +a colon, to distinguish it from an actual feature. + +=end original + +Ê£¿ô¤Îµ¡Ç½¤Î¤Þ¤È¤á¤ÆÆɤ߹þ¤à¤¿¤á¤Ë¤Ï¡¢I<µ¡Ç½¤Î«> (feature bundle) ¤¬ +»È¤¨¤Þ¤¹¡£ +µ¡Ç½¤Î«¤Î̾Á°¤Ë¤Ï¡¢¼ÂºÝ¤Îµ¡Ç½¤È¶èÊ̤¹¤ë¤¿¤á¤Ë¥³¥í¥ó¤¬Á°ÃÖ¤µ¤ì¤Þ¤¹¡£ + + use feature ":5.10"; + +=begin original + +The following feature bundles are available: + +=end original + +°Ê²¼¤Îµ¡Ç½¤Î«¤¬ÍøÍѲÄǽ¤Ç¤¹: + + bundle features included + --------- ----------------- + :default array_base + + :5.10 say state switch array_base + + :5.12 say state switch unicode_strings array_base + + :5.14 say state switch unicode_strings array_base + + :5.16 say state switch unicode_strings + unicode_eval evalbytes current_sub fc + + :5.18 say state switch unicode_strings + unicode_eval evalbytes current_sub fc + + :5.20 say state switch unicode_strings + unicode_eval evalbytes current_sub fc + +=begin original + +The C<:default> bundle represents the feature set that is enabled before +any C<use feature> or C<no feature> declaration. + +=end original + +C<:default> «¤Ï¡¢C<use feature> ¤ä C<no feature> Àë¸À¤¬Í¸ú¤Ë¤Ê¤ëÁ°¤Î +µ¡Ç½½¸¹ç¤òɽ¸½¤·¤Æ¤¤¤Þ¤¹¡£ + +=begin original + +Specifying sub-versions such as the C<0> in C<5.14.0> in feature bundles has +no effect. Feature bundles are guaranteed to be the same for all sub-versions. + +=end original + +µ¡Ç½¤Î«¤Ç¤Î C<5.14.0> ¤Î C<0> ¤Î¤è¤¦¤ÊÉû¥Ð¡¼¥¸¥ç¥ó¤ò»ØÄꤷ¤Æ¤â¸ú²Ì¤Ï +¤¢¤ê¤Þ¤»¤ó¡£ +µ¡Ç½¤Î«¤ÏÁ´¤Æ¤ÎÉû¥Ð¡¼¥¸¥ç¥ó¤Ë´Ø¤·¤ÆƱ¤¸»ö¤¬Êݾڤµ¤ì¤Æ¤¤¤Þ¤¹¡£ + + use feature ":5.14.0"; # same as ":5.14" + use feature ":5.14.1"; # same as ":5.14" + +=head1 IMPLICIT LOADING + +(°ÅÌÛ¤ÎÆɤ߹þ¤ß) + +=begin original + +Instead of loading feature bundles by name, it is easier to let Perl do +implicit loading of a feature bundle for you. + +=end original + +µ¡Ç½¤Î«¤ò̾Á°¤ÇÆɤ߹þ¤à¤è¤ê¡¢Perl ¤Ëµ¡Ç½¤Î«¤ò°ÅÌÛ¤ËÆɤ߹þ¤Þ¤»¤ë¤è¤¦¤Ë +¤·¤¿Êý¤¬´Êñ¤Ç¤¹¡£ + +=begin original + +There are two ways to load the C<feature> pragma implicitly: + +=end original + +C<feature> ¥×¥é¥°¥Þ¤ò°ÅÌÛ¤ËÆɤ߹þ¤à¤Ë¤ÏÆó¤Ä¤ÎÊýË¡¤¬¤¢¤ê¤Þ¤¹: + +=over 4 + +=item * + +=begin original + +By using the C<-E> switch on the Perl command-line instead of C<-e>. +That will enable the feature bundle for that version of Perl in the +main compilation unit (that is, the one-liner that follows C<-E>). + +=end original + +Perl ¤Î¥³¥Þ¥ó¥É¥é¥¤¥ó¤Ç C<-e> ¥ª¥×¥·¥ç¥ó¤ÎÂå¤ï¤ê¤Ë C<-E> ¥ª¥×¥·¥ç¥ó¤ò +»ÈÍѤ·¤¿¾ì¹ç¡£ +¤³¤ì¤Ë¤è¤ê¡¢main ¥³¥ó¥Ñ¥¤¥ëñ°Ì(¤Ä¤Þ¤ê¡¢C<-E> ¤Ë°ú¤Â³¤¯ 1 ¹ÔÌîϺ)¤Ç +¤½¤Î¥Ð¡¼¥¸¥ç¥ó¤Î Perl ¤Îµ¡Ç½¤Î«¤¬Í¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£ + +=item * + +=begin original + +By explicitly requiring a minimum Perl version number for your program, with +the C<use VERSION> construct. That is, + +=end original + +C<use VERSION> ¹½Ê¸¤ò»È¤Ã¤Æ¥×¥í¥°¥é¥à¤¬É¬ÍפȤ¹¤ëºÇÄã¸Â¤Î Perl ¥Ð¡¼¥¸¥ç¥ó +ÈÖ¹æ¤òÌÀ¼¨Åª¤Ë»ØÄꤷ¤¿¾ì¹ç¡£ +¤Ä¤Þ¤ê¡¢°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ë¤È: + + use v5.10.0; + +=begin original + +will do an implicit + +=end original + +°ÅÌۤΤ¦¤Á¤Ë°Ê²¼¤Î¤è¤¦¤Ë: + + no feature ':all'; + use feature ':5.10'; + +=begin original + +and so on. Note how the trailing sub-version +is automatically stripped from the +version. + +=end original + +¤Ê¤ë¤È¤¤¤¦¤³¤È¤Ç¤¹¡£ +ËöÈø¤ÎÉû¥Ð¡¼¥¸¥ç¥ó¤Ï¼«Æ°Åª¤Ë¥Ð¡¼¥¸¥ç¥ó¤«¤é¼è¤ê½ü¤«¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¤³¤È¤Ë +Ãí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ + +=begin original + +But to avoid portability warnings (see L<perlfunc/use>), you may prefer: + +=end original + +¤·¤«¤·°Ü¿¢À¤Î·Ù¹ð(L<perlfunc/use> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤)¤òÈò¤±¤ë¤¿¤á¤Ë¡¢ +°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ë¤Î¤ò¹¥¤à¤«¤â¤·¤ì¤Þ¤»¤ó: + + use 5.010; + +=begin original + +with the same effect. + +=end original + +¤³¤ì¤Ç¤âƱ¤¸¸ú²Ì¤¬ÆÀ¤é¤ì¤Þ¤¹¡£ + +=begin original + +If the required version is older than Perl 5.10, the ":default" feature +bundle is automatically loaded instead. + +=end original + +Í׵ᤷ¤¿¥Ð¡¼¥¸¥ç¥ó¤¬ Perl 5.10 ¤è¤êÁ°¤Î¾ì¹ç¡¢Âå¤ï¤ê¤Ëµ¡Ç½¤Î« ":default" ¤¬ +¼«Æ°Åª¤ËÆɤ߹þ¤Þ¤ì¤Þ¤¹¡£ + +=back + +=begin meta + +Translate: SHIRAKATA Kentaro <argra****@ub32*****> +Status: completed + +=end meta + +=cut +