1POE::Pipe::TwoWay(3)  User Contributed Perl Documentation POE::Pipe::TwoWay(3)
2
3
4

NAME

6       POE::Pipe::TwoWay - portable two-way pipe creation (works without POE)
7

SYNOPSIS

9         my ($a_read, $a_write, $b_read, $b_write) = POE::Pipe::TwoWay->new();
10         die "couldn't create a pipe: $!" unless defined $a_read;
11

DESCRIPTION

13       POE::Pipe::TwoWay makes unbuffered two-way pipes or it dies trying.  It
14       can be more frugal with filehandles than two OneWay pipes when socket‐
15       pair() is available.
16
17       Pipes are troublesome beasts because the different pipe creation meth‐
18       ods have spotty support from one system to another.  Some systems have
19       "pipe()", others have "socketfactory()", and still others have neither.
20
21       POE::Pipe::TwoWay tries different ways to make a pipe in the hope that
22       one of them will succeed on any given platform.  It tries them in sock‐
23       etpair() -> pipe() -> IO::Socket::INET order.  If socketpair() is
24       available, the two-way pipe will use half as many filehandles as two
25       one-way pipes.
26
27       So anyway, the syntax is pretty easy:
28
29         my ($a_read, $a_write, $b_read, $b_write) = POE::Pipe::TwoWay->new();
30         die "couldn't create a pipe: $!" unless defined $a_read;
31
32       And now you have an unbuffered pipe with two read/write sides, A and B.
33       Writing to $a_write passes data to $b_read, and writing to $b_write
34       passes data to $a_read.
35

CONSTRUCTOR

37       new
38             my ($a_read, $a_write, $b_read, $b_write) = POE::Pipe::TwoWay->new();
39

DEBUGGING

41       It's possible to force POE::Pipe::TwoWay to use one of its underlying
42       pipe methods.  This was implemented for exercising each method in
43       tests, but it's possibly useful for others.
44
45       However, forcing TwoWay's pipe method isn't documented because it's
46       cheezy and likely to change.  Use it at your own risk.
47

BUGS

49       The INET domain socket method may block for up to 1s if it fails.
50
52       POE::Pipe::TwoWay is copyright 2000 by Rocco Caputo.  All rights
53       reserved.  POE::Pipe::TwoWay is free software; you may redistribute it
54       and/or modify it under the same terms as Perl itself.
55
56
57
58perl v5.8.8                       2006-09-01              POE::Pipe::TwoWay(3)
Impressum