1IO::Pipe(3pm)          Perl Programmers Reference Guide          IO::Pipe(3pm)
2
3
4

NAME

6       IO::Pipe - supply object methods for pipes
7

SYNOPSIS

9               use IO::Pipe;
10
11               $pipe = IO::Pipe->new();
12
13               if($pid = fork()) { # Parent
14                   $pipe->reader();
15
16                   while(<$pipe>) {
17                       ...
18                   }
19
20               }
21               elsif(defined $pid) { # Child
22                   $pipe->writer();
23
24                   print $pipe ...
25               }
26
27               or
28
29               $pipe = IO::Pipe->new();
30
31               $pipe->reader(qw(ls -l));
32
33               while(<$pipe>) {
34                   ...
35               }
36

DESCRIPTION

38       "IO::Pipe" provides an interface to creating pipes between processes.
39

CONSTRUCTOR

41       new ( [READER, WRITER] )
42           Creates an "IO::Pipe", which is a reference to a newly created
43           symbol (see the "Symbol" package). "IO::Pipe::new" optionally takes
44           two arguments, which should be objects blessed into "IO::Handle",
45           or a subclass thereof. These two objects will be used for the
46           system call to "pipe". If no arguments are given then method
47           "handles" is called on the new "IO::Pipe" object.
48
49           These two handles are held in the array part of the GLOB until
50           either "reader" or "writer" is called.
51

METHODS

53       reader ([ARGS])
54           The object is re-blessed into a sub-class of "IO::Handle", and
55           becomes a handle at the reading end of the pipe. If "ARGS" are
56           given then "fork" is called and "ARGS" are passed to exec.
57
58       writer ([ARGS])
59           The object is re-blessed into a sub-class of "IO::Handle", and
60           becomes a handle at the writing end of the pipe. If "ARGS" are
61           given then "fork" is called and "ARGS" are passed to exec.
62
63       handles ()
64           This method is called during construction by "IO::Pipe::new" on the
65           newly created "IO::Pipe" object. It returns an array of two objects
66           blessed into "IO::Pipe::End", or a subclass thereof.
67

SEE ALSO

69       IO::Handle
70

AUTHOR

72       Graham Barr. Currently maintained by the Perl Porters.  Please report
73       all bugs to <perlbug@perl.org>.
74
76       Copyright (c) 1996-8 Graham Barr <gbarr@pobox.com>. All rights
77       reserved.  This program is free software; you can redistribute it
78       and/or modify it under the same terms as Perl itself.
79
80
81
82perl v5.34.1                      2022-03-15                     IO::Pipe(3pm)
Impressum