IO::Pipe
Native Rust implementation built into the interpreter. Runtime: PP. See original documentation for the full Perl reference.
Provides object-oriented pipe operations compatible with Perl’s IO::Pipe. IO::Pipe objects are blessed hashrefs storing reader/writer fh_ids.
For fork-based communication, reader()/writer() without args just
configures the object to the appropriate end of the pipe.
Functions
handles
Returns two unopened IO::Pipe::End objects (reader, writer) that can be configured independently.
my ($reader, $writer) = $pipe->handles();
new
Creates a pipe pair via pipe(2). Returns a blessed IO::Pipe object
holding both reader and writer filehandle IDs internally.
use IO::Pipe;
my $pipe = IO::Pipe->new();
reader
Configures the pipe as the reader end. Without arguments, closes the write end and re-blesses as IO::Pipe::End. With a command, forks a child that execvp’s the command with its stdout connected to the pipe; the parent reads from the pipe.
$pipe->reader("ls", "-l"); # fork+exec, parent reads
$pipe->reader(); # just configure reader end
writer
Configures the pipe as the writer end. Without arguments, closes the read end and re-blesses as IO::Pipe::End. With a command, forks a child that execvp’s the command with its stdin connected to the pipe; the parent writes to the pipe.
$pipe->writer("sort"); # fork+exec, parent writes
$pipe->writer(); # just configure writer end