[perldocjp-cvs 2208] CVS update: docs/modules/feature-1.16

Back to archive index
argra****@users***** argra****@users*****
2019年 12月 19日 (木) 05:04:47 JST


Date:	Thursday December 19, 2019 @ 05:04
Author:	argrath

Update of /cvsroot/perldocjp/docs/modules/feature-1.16
In directory sf-cvs:/tmp/cvs-serv3895/modules/feature-1.16

Added Files:
	feature.pod 
Log Message:
feature-1.16
===================================================================
File: feature.pod      	Status: Up-to-date

   Working revision:	1.1	Wed Dec 18 20:04:47 2019
   Repository revision:	1.1	/cvsroot/perldocjp/docs/modules/feature-1.16/feature.pod,v

   Existing Tags:
	No Tags Exist

-------------- next part --------------
Index: docs/modules/feature-1.16/feature.pod
diff -u /dev/null docs/modules/feature-1.16/feature.pod:1.1
--- /dev/null	Thu Dec 19 05:04:47 2019
+++ docs/modules/feature-1.16/feature.pod	Thu Dec 19 05:04:47 2019
@@ -0,0 +1,308 @@
+
+=encoding euc-jp
+
+=head1 NAME
+
+=begin original
+
+feature - Perl pragma to enable new features
+
+=end original
+
+feature - ¿·¤·¤¤µ¡Ç½¤òÍ­¸ú¤Ë¤¹¤ë¥×¥é¥°¥Þ
+
+=head1 SYNOPSIS
+
+    use feature qw(switch say);
+    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
+
+=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.
+
+=end original
+
+´û¤Ë¸ºß¤·¤Æ¤¤¤ë¥×¥í¥°¥é¥à¤ò²õ¤¹¤³¤È¤Ê¤¯¡¢Perl ¤Ë¿·¤·¤¤Ê¸Ë¡¤òÄɲ乤뤳¤È¤Ï¡¢
+ÉáÄ̤ÏÉÔ²Äǽ¤Ç¤¹¡£
+¤³¤Î¥×¥é¥°¥Þ¤Ï¡¢¥ê¥¹¥¯¤òºÇ¾®²½¤¹¤ëÊýË¡¤òÄ󶡤·¤Þ¤¹¡£
+¿·¤·¤¤Ê¸Ë¡¹½Â¤¤ä¡¢¸Å¤¤¹½Â¤¤Î¿·¤·¤¤°ÕÌ£¤Ï¡¢C<use feature 'foo'> ¤ÇÍ­¸ú²½¤µ¤ì¡¢
+ŬÀÚ¤Ê feature ¥×¥é¥°¥Þ¤¬¥¹¥³¡¼¥×Æâ¤Ë¤¢¤ë¾ì¹ç¤Ë¤Î¤ß¥Ñ¡¼¥¹¤µ¤ì¤Þ¤¹¡£
+
+=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 turn off all features.
+
+=end original
+
+C<no feature> ¤È¡¢µ¡Ç½¤ò»ØÄꤻ¤º¤Ë»È¤¦¤È¡¢Á´¤Æ¤Îµ¡Ç½¤¬Ìµ¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
+
+=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"> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+=head2 The 'say' feature
+
+('say' µ¡Ç½)
+
+=begin original
+
+C<use feature 'say'> tells the compiler to enable the Perl 6
+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> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+=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"> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+=head2 the 'unicode_strings' feature
+
+('unicode_strings' µ¡Ç½)
+
+=begin original
+
+C<use feature 'unicode_strings'> tells the compiler to treat
+all strings outside of C<use locale> and C<use bytes> as Unicode. It is
+available starting with Perl 5.11.3.
+
+=end original
+
+C<use feature 'unicode_strings'> ¤Ï¥³¥ó¥Ñ¥¤¥é¤Ë¡¢
+C<use locale> ¤È C<use bytes> ¤Î³°Â¦¤ÎÁ´¤Æ¤Îʸ»úÎó¤ò Unicode ¤È¤·¤Æ
+°·¤¦¤è¤¦¤ËÅÁ¤¨¤Þ¤¹¡£
+¤³¤ì¤Ï Perl 5.11.3 ¤«¤éÍøÍѲÄǽ¤Ç¤¹¡£
+
+=begin original
+
+See L<perlunicode/The "Unicode Bug"> for details.
+
+=end original
+
+¾Ü¤·¤¯¤Ï L<perlunicode/The "Unicode Bug"> ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+=head1 FEATURE BUNDLES
+
+(µ¡Ç½¤Î«)
+
+=begin original
+
+It's possible to load a whole slew of features in one go, using
+a I<feature bundle>. The name of a feature bundle is prefixed with
+a colon, to distinguish it from an actual feature. At present, the
+only feature bundle is C<use feature ":5.10"> which is equivalent
+to C<use feature qw(switch say state)>.
+
+=end original
+
+ÂçÎ̤ε¡Ç½Á´ÂΤò 1 ²ó¤ÇÆɤ߹þ¤à¤¿¤á¤Ë¤Ï¡¢I<µ¡Ç½¤Î«> (feature bundle) ¤¬
+»È¤¨¤Þ¤¹¡£
+µ¡Ç½¤Î«¤Î̾Á°¤Ë¤Ï¡¢¼ÂºÝ¤Îµ¡Ç½¤È¶èÊ̤¹¤ë¤¿¤á¤Ë¥³¥í¥ó¤¬Á°ÃÖ¤µ¤ì¤Þ¤¹¡£
+¸½ºß¤Î¤È¤³¤í¡¢Í£°ì¤Îµ¡Ç½¤Î«¤Ï C<use feature ":5.10"> ¤Ç¡¢
+C<use feature qw(switch say state)> ¤ÈÅù²Á¤Ç¤¹¡£
+
+=begin original
+
+Specifying sub-versions such as the C<0> in C<5.10.0> in feature bundles has
+no effect: feature bundles are guaranteed to be the same for all sub-versions.
+
+=end original
+
+µ¡Ç½¤Î«¤Ç¤Î  C<5.10.0> ¤Î C<0> ¤Î¤è¤¦¤ÊÉû¥Ð¡¼¥¸¥ç¥ó¤ò»ØÄꤷ¤Æ¤â¸ú²Ì¤Ï
+¤¢¤ê¤Þ¤»¤ó: µ¡Ç½¤Î«¤ÏÁ´¤Æ¤ÎÉû¥Ð¡¼¥¸¥ç¥ó¤Ë´Ø¤·¤ÆƱ¤¸»ö¤¬Êݾڤµ¤ì¤Æ¤¤¤Þ¤¹¡£
+
+=head1 IMPLICIT LOADING
+
+(°ÅÌÛ¤ÎÆɤ߹þ¤ß)
+
+=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 command-line instead of C<-e>. It enables
+all available features in the main compilation unit (that is, the one-liner.)
+
+=end original
+
+¥³¥Þ¥ó¥É¥é¥¤¥ó¤Ç C<-e> ¥ª¥×¥·¥ç¥ó¤ÎÂå¤ï¤ê¤Ë C<-E> ¥ª¥×¥·¥ç¥ó¤ò»È¤¤¤Þ¤¹¡£
+¤³¤ì¤Ë¤è¤ê¡¢main ¥³¥ó¥Ñ¥¤¥ëñ°Ì(¤Ä¤Þ¤ê¡¢1 ¹ÔÌîϺ)¤ÇÁ´¤Æ¤ÎÍøÍѲÄǽ¤Êµ¡Ç½¤¬
+Í­¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
+
+=item *
+
+=begin original
+
+By requiring explicitly a minimal Perl version number for your program, with
+the C<use VERSION> construct, and when the version is higher than or equal to
+5.10.0. That is,
+
+=end original
+
+¤Ä¤Þ¤ê¡¢°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ë¤È:
+
+    use 5.10.0;
+
+=begin original
+
+will do an implicit
+
+=end original
+
+°ÅÌۤΤ¦¤Á¤Ë°Ê²¼¤Î¤è¤¦¤Ë:
+
+    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
+
+¤³¤ì¤Ç¤âƱ¤¸¸ú²Ì¤¬ÆÀ¤é¤ì¤Þ¤¹¡£
+
+=back
+
+=begin meta
+
+Translate: SHIRAKATA Kentaro <argra****@ub32*****>
+Status: completed
+
+=end meta
+
+=cut
+


perldocjp-cvs メーリングリストの案内
Back to archive index