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

Back to archive index

argra****@users***** argra****@users*****
2008年 7月 8日 (火) 18:55:17 JST


Index: docs/perl/5.10.0/perlfaq4.pod
diff -u docs/perl/5.10.0/perlfaq4.pod:1.8 docs/perl/5.10.0/perlfaq4.pod:1.9
--- docs/perl/5.10.0/perlfaq4.pod:1.8	Sat Jun 14 06:05:15 2008
+++ docs/perl/5.10.0/perlfaq4.pod	Tue Jul  8 18:55:17 2008
@@ -2051,11 +2051,8 @@
 行われるので、先頭と末尾の両方で行われます。
 引き続く改行は C<\s+> にマッチングし、C<$> アンカーは文字列の物理的な
 末尾にマッチングするので、改行も消えることを忘れないでください。
-Just add
-the newline to the output, which has the added benefit of preserving
-"blank" (consisting entirely of whitespace) lines which the C<^\s+>
-would remove all by itself.
-(TBT)
+単に出力に改行を追加することで、C<^\s+> がすべて削除してしまう「空の」
+(空白だけからなる)行を保存する利点が追加されます。
 
 	while( <> )
 		{
@@ -2822,16 +2819,14 @@
 
 =end original
 
-You can also go through each element and skip the ones you've seen
-before. Use a hash to keep track. The first time the loop sees an
-element, that element has no key in C<%Seen>. The C<next> statement
-creates the key and immediately uses its value, which is C<undef>, so
-the loop continues to the C<push> and increments the value for that
-key. The next time the loop sees that same element, its key exists in
-the hash I<and> the value for that key is true (since it's not 0 or
-C<undef>), so the next skips that iteration and the loop goes to the
-next element.
-(TBT)
+各要素を調べて、一度見つけたものをスキップすることもできます。
+記録をつけるためにハッシュを使います。
+ループが最初に要素を見つけると、この要素は C<%Seen> にキーがありません。
+C<next> 文はキーを作り、直ちにその値(C<undef>)を使うので、
+ループは C<push> を続行し、このキーの値をインクリメントします。
+次回にループが同じ要素を見つけると、ハッシュにはそのキーが存在し、
+I<かつ> そのキーの値が(0 でも C<undef> でもないので)真なので、
+next は反復をスキップし、ループは次の要素に進みます。
 
 	my @unique = ();
 	my %seen   = ();
Index: docs/perl/5.10.0/perlfaq5.pod
diff -u docs/perl/5.10.0/perlfaq5.pod:1.7 docs/perl/5.10.0/perlfaq5.pod:1.8
--- docs/perl/5.10.0/perlfaq5.pod:1.7	Sat Jun 14 06:05:15 2008
+++ docs/perl/5.10.0/perlfaq5.pod	Tue Jul  8 18:55:17 2008
@@ -762,11 +762,11 @@
 =end original
 
 お好みなら、これらのファイルハンドルを配列やハッシュに保管することもできます。
-If you access them directly, they aren't simple scalars and you
-need to give C<print> a little help by placing the filehandle
-reference in braces. Perl can only figure it out on its own when
-the filehandle reference is a simple scalar.
-(TBT)
+これらを直接アクセスすると、これらは単なるスカラではないので、
+ファイルハンドルを中かっこで囲むことで C<print> に少し助けを与える必要が
+あります。
+Perl はファイルハンドルリファレンスが単純なスカラの場合にのみファイル
+ハンドルリファレンスと認識します。
 
 	my @fhs = ( $fh1, $fh2, $fh3 );
 
@@ -1730,13 +1730,12 @@
 
 =end original
 
-If you are on a system that correctly implements flock() and you use the
-example appending code from "perldoc -f flock" everything will be OK
-even if the OS you are on doesn't implement append mode correctly (if
-such a system exists.) So if you are happy to restrict yourself to OSs
-that implement flock() (and that's not really much of a restriction)
-then that is what you should do.
-(TBT)
+もし flock() が正しく実装されているシステムを使っていて、
+"perldoc -f flock" にある追加コードの例を使っているなら、たとえ使っている
+OS が追加モードを正しく実装していない(もしそのようなシステムがあれば)
+場合でも、全てうまくいきます。
+従って、実行する OS を flock() が実装されているものに制限してもよいなら
+(これは実際のところそれほど大きな制限ではありません)、そうするべきです。
 
 =begin original
 
@@ -1763,15 +1762,14 @@
 
 =end original
 
-If you know you are only writing code to run on an OS and filesystem that
-does implement append mode correctly (a local filesystem on a modern
-Unix for example), and you keep the file in block-buffered mode and you
-write less than one buffer-full of output between each manual flushing
-of the buffer then each bufferload is almost guaranteed to be written to
-the end of the file in one chunk without getting intermingled with
-anyone else's output. You can also use the syswrite() function which is
-simply a wrapper around your systems write(2) system call.
-(TBT)
+追加モードを正しく実装している OS とファイルシステム(例えば最近の Unix の
+ローカルファイルシステム)でのみ実行されることがわかっていて、
+ファイルをブロックバッファモードのままに維持していて、
+手動でのバッファのフラッシュの間にバッファがいっぱいになるほどの
+書き込みを行わない場合は、それぞれのバッファは他からの出力が混ざることなく、
+ファイルの末尾にひとつの塊で書き込まれることがほとんど保証されます
+write(2) システムコールの単なるラッパである syswrite() を使うことも
+できます。
 
 =begin original
 


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