1POE::Pipe::OneWay(3) User Contributed Perl Documentation POE::Pipe::OneWay(3)
2
3
4
6 POE::Pipe::OneWay - a portable API for one-way pipes
7
9 my ($read, $write) = POE::Pipe::OneWay->new();
10 die "couldn't create a pipe: $!" unless defined $read;
11
13 The right way to create an anonymous pipe varies from one operating
14 system to the next. Some operating systems support "pipe()". Others
15 require "socketpair()". And a few operating systems support neither,
16 so a plain old socket must be created.
17
18 POE::Pipe::OneWay will attempt to create a unidirectional pipe using
19 "pipe()", "socketpair()", and IO::Socket::INET, in that order.
20 Exceptions are hardcoded for operating systems with broken or
21 nonstandard behaviors.
22
23 The upshot of all this is that an application can portably create a
24 one-way pipe by instantiating POE::Pipe::OneWay. The work of deciding
25 how to create the pipe and opening the handles will be taken care of
26 internally.
27
28 POE::Pipe::OneWay may be used outside of POE, as it doesn't use POE
29 internally.
30
32 new [TYPE]
33 Create a new one-way pipe, optionally constraining it to a particular
34 TYPE of pipe. One-way pipes have two ends: a "read" end and a "write"
35 end. On success, new() returns two handles: one for the "read" end and
36 one for the "write" end. Returns nothing on failure, and sets $! to
37 explain why the constructor failed.
38
39 my ($read, $write) = POE::Pipe::OneWay->new();
40 die $! unless defined $read;
41
42 TYPE may be one of "pipe", "socketpair", or "inet". When set,
43 POE::Pipe::OneWay will constrain its search to either "pipe()", a UNIX-
44 domain "socketpair()", or plain old sockets, respectively. Otherwise
45 new() will try each method in order, or a particular method
46 predetermined to be the best one for the current operating environment.
47
49 POE::Pipe::OneWay may block up to one second on some systems if failure
50 occurs while trying to create "inet" sockets.
51
53 POE::Pipe, POE::Pipe::TwoWay.
54
56 POE::Pipe::OneWay is copyright 2000-2008 by Rocco Caputo. All rights
57 reserved. POE::Pipe::OneWay is free software; you may redistribute it
58 and/or modify it under the same terms as Perl itself.
59
60
61
62perl v5.12.1 2010-04-03 POE::Pipe::OneWay(3)