[perldocjp-cvs 320] CVS update: docs/perl/5.10.0

Back to archive index

argra****@users***** argra****@users*****
2008年 12月 7日 (日) 17:47:35 JST


Index: docs/perl/5.10.0/perlsub.pod
diff -u docs/perl/5.10.0/perlsub.pod:1.5 docs/perl/5.10.0/perlsub.pod:1.6
--- docs/perl/5.10.0/perlsub.pod:1.5	Wed Dec  3 01:46:55 2008
+++ docs/perl/5.10.0/perlsub.pod	Sun Dec  7 17:47:34 2008
@@ -1240,25 +1240,64 @@
 
 Synopsis:
 
+=begin original
+
     # localization of values
 
+=end original
+
+    # 値のローカル化
+
+=begin original
+
     local $foo;			# make $foo dynamically local
     local (@wid, %get);		# make list of variables local
     local $foo = "flurp";	# make $foo dynamic, and init it
     local @oof = @bar;		# make @oof dynamic, and init it
 
+=end original
+
+    local $foo;			# $foo を動的にローカルにする
+    local (@wid, %get);		# 変数のリストをローカルにする
+    local $foo = "flurp";	# $foo を動的にして、初期化する
+    local @oof = @bar;		# @oof を動的にして、初期化する
+
+=begin original
+
     local $hash{key} = "val";	# sets a local value for this hash entry
     local ($cond ? $v1 : $v2);	# several types of lvalues support
 				# localization
 
+=end original
+
+    local $hash{key} = "val";	# このハッシュエントリにローカルな値を入れる
+    local ($cond ? $v1 : $v2);	# いくつかの種類の左辺値はローカル化に
+				# 対応している
+
+=begin original
+
     # localization of symbols
 
+=end original
+
+    # シンボルのローカル化
+
+=begin original
+
     local *FH;			# localize $FH, @FH, %FH, &FH  ...
     local *merlyn = *randal;	# now $merlyn is really $randal, plus
                                 #     @merlyn is really @randal, etc
     local *merlyn = 'randal';	# SAME THING: promote 'randal' to *randal
     local *merlyn = \$randal;   # just alias $merlyn, not @merlyn etc
 
+=end original
+
+    local *FH;			# $FH, @FH, %FH, &FH ... をローカル化
+    local *merlyn = *randal;	# ここで $merlyn は実際には $randal、さらに
+                                #        @merlyn は実際には @randal、など
+    local *merlyn = 'randal';	# 「同様」: 'randal' を *randal にする
+    local *merlyn = \$randal;   # 単に $merlyn の別名で @merlyn などではない
+
 =begin original
 
 A C<local> modifies its listed variables to be "local" to the
@@ -1450,7 +1489,7 @@
 
 =end original
 
-B<WARNING>: tie された配列とハッシュのローカル化は現在のところ
+B<警告>: tie された配列とハッシュのローカル化は現在のところ
 記述されたとおりに動作しません。
 これは Perl の将来のリリースで修正されます;
 当面の間は、tie された配列やハッシュのローカル化によるどのような
@@ -1498,11 +1537,11 @@
 
 =end original
 
-This implies, among other things, that any magic eventually carried by
-those variables is locally lost.
+これは特に、
+最終的にこれらの変数によってもたらされるマジックは局所的には
+失われることを意味します。
 言い換えると、C<local */> としても、入力レコードセパレータの内部の
 値には何の影響も与えないということです。
-(TBT)
 
 =begin original
 
@@ -1514,12 +1553,11 @@
 
 =end original
 
-Notably, if you want to work with a brand new value of the default scalar
-$_, and avoid the potential problem listed above about $_ previously
-carrying a magic value, you should use C<local *_> instead of C<local $_>.
+とりわけ、もしデフォルトスカラ $_ の新しい値で作業をしたいけれども、
+上述した、$_ が以前運んでいたマジカルな値に関する潜在的な問題を避けたいなら、
+C<local $_> ではなく C<local *_> を使うべきです。
 perl 5.9.1 以降、(C<my $_> とすることで) レキシカルな C<$_> を使うこともでき、
 これによってこの問題を完全に回避できます。
-(TBT)
 
 =head3 Localization of elements of composite types
 X<local, composite type element> X<local, array element> X<local, hash element>
@@ -1712,12 +1750,10 @@
 =end original
 
 これはカプセル化に違反しています。
-通常の mutator は
-can check the supplied
-argument before setting the attribute it is protecting,
+通常の mutator は、自身が保護している属性にセットする前に
+引数をチェックできますが、
 左辺値サブルーチンにはその機会はありません。
-以下を考えると;
-(TBT)
+以下を考えてみてください;
 
     my $some_array_ref = [];	# protected by mutators ??
 
@@ -2543,13 +2579,12 @@
 
 =end original
 
-If you try to use an alphanumeric sequence in a prototype you will
-generate an optional warning - "Illegal character in prototype...".
-Unfortunately earlier versions of Perl allowed the prototype to be
-used as long as its prefix was a valid prototype.  The warning may be
-upgraded to a fatal error in a future version of Perl once the
-majority of offending code is fixed.
-(TBT)
+もしプロトタイプに英数字を使おうとすると、オプションの警告
+"Illegal character in prototype..." が生成されます。
+残念ながら、過去のバージョンの Perl では、有効なプロトタイプが前置されてさえ
+いれば、英数字を含むプロトタイプも認められていました。
+この警告は、目障りなコードの大部分が修正されたなら、将来のバージョンの
+Perl で致命的エラーに格上げされるかもしれません。
 
 =begin original
 


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