=encoding euc-jp =head1 NAME POE::Pipe::TwoWay - portable two-way pipe creation (works without POE) POE::Pipe::TwoWay - 移植可能な双方向パイプの生成(POE無しに動作) =head1 SYNOPSIS my ($a_read, $a_write, $b_read, $b_write) = POE::Pipe::TwoWay->new(); die "couldn't create a pipe: $!" unless defined $a_read; =head1 DESCRIPTION POE::Pipe::TwoWay makes unbuffered two-way pipes or it dies trying. It can be more frugal with filehandles than two OneWay pipes when socketpair() is available. POE::Pipe::TwoWayはバッファのない双方向のパイプを作るか挑戦して死にます。 socketpair()が利用可能なときは2つのOneWayパイプよりもファイルハンドルを 節約することができます。 Pipes are troublesome beasts because the different pipe creation methods have spotty support from one system to another. Some systems have C, others have C, and still others have neither. 異なったパイプ生成メソッドはシステムごとにむらの多いサポートを持ってい るのでパイプはやっかいな獣です。Cを持っているシステムがあり、他 はCを持っており、いまだにどちらも持たないものもありま す。 POE::Pipe::TwoWay tries different ways to make a pipe in the hope that one of them will succeed on any given platform. It tries them in socketpair() -> pipe() -> IO::Socket::INET order. If socketpair() is available, the two-way pipe will use half as many filehandles as two one-way pipes. POE::Pipe::TwoWayはパイプを作るためにどんな与えられたプラットフォーム上 でもどれか一つが動くことを期待して様々な方法を試します。それらは socketpair() -> pipe() -> IO::Socket::INETの順番で試されます。もし socketpair()が利用可能であれば、双方向パイプは2つの片方向パイプを使うの に比べて半分のファイルハンドルで済むでしょう。 So anyway, the syntax is pretty easy: とにかく、構文はとても簡単です。 my ($a_read, $a_write, $b_read, $b_write) = POE::Pipe::TwoWay->new(); die "couldn't create a pipe: $!" unless defined $a_read; And now you have an unbuffered pipe with two read/write sides, A and B. Writing to C<$a_write> passes data to C<$b_read>, and writing to C<$b_write> passes data to C<$a_read>. そしてAとBの2つの読み込み/書き込み側を持ったバッファのないパイプを手に 入れることができます。C<$a_write>への書き込みはC<$b_read>にデータが渡さ れ、C<$b_write>への書き込みはC<$a_read>にデータが渡されます。 =head1 DEBUGGING It's possible to force POE::Pipe::TwoWay to use one of its underlying pipe methods. This was implemented for exercising each method in tests, but it's possibly useful for others. POE::Pipe::TwoWayが内在するパイプメソッドの一つを使うように強制すること は可能です。それはテストで各メソッドを用いるために実装されましたが、も しかすると他のことにも役立つかもしれません。 However, forcing TwoWay's pipe method isn't documented because it's cheezy and likely to change. Use it at your own risk. しかし、TwoWayのパイプメソッドの強制は粗末で変更されそうなのでドキュメ ント化されていません。自己責任で使用してください。 =head1 BUGS The INET domain socket method may block for up to 1s if it fails. INETドメインソケットメソッドは失敗したとき最大1秒間ブロックするかもしれ ません。 =head1 AUTHOR & COPYRIGHT POE::Pipe::TwoWay is copyright 2000 by Rocco Caputo. All rights reserved. POE::Pipe::TwoWay is free software; you may redistribute it and/or modify it under the same terms as Perl itself. =head1 Translators 井上 謙次