NAME
IOMux::Pipe::Read - read from an external command
INHERITANCE
IOMux::Pipe::Read
is an IOMux::Handler::Read
is an IOMux::Handler
SYNOPSIS
my $mux = IOMux::Select->new; # or ::Poll
use IOMux::Open '-|';
my $pipe = $mux->open('-|', $command, @cmd_options);
use IOMux::Pipe::Read;
my $pipe = IOMux::Pipe::Read->new
( command => [$command, @cmd_options] );
$mux->add($pipe);
$pipe->getline(sub {print "$_[0]\n"});
DESCRIPTION
In an event driven program, reading is harder to use than writing: the read will very probably be stalled until data has arrived, so you will need a callback to handle the resulting data.
Extends "DESCRIPTION" in IOMux::Handler::Read.
METHODS
Extends "METHODS" in IOMux::Handler::Read.
Constructors
Extends "Constructors" in IOMux::Handler::Read.
- IOMux::Pipe::Read->bare(%options)
-
Creates a pipe, but does not start a process (yet). Used by IOMux::IPC, which needs three pipes for one process. Returned is not only a new pipe object, but also a write handle to be connected to the other side.
All %options which are available to IOMux::Handler::Read::new() can be used here as well.
-Option --Default read_size 4096
example:
my ($out, $out_rh) = IOMux::Pipe::Read->bare(name => 'stdout');
- IOMux::Pipe::Read->new(%options)
-
-Option --Defined in --Default command <required> fh IOMux::Handler <required> name IOMux::Handler '$cmd|' read_size IOMux::Handler::Read 4096
- IOMux::Pipe::Read->open( $mode, <$cmd, $cmdopts>|<$cmdarray, %options> )
-
Open the pipe to read. $mode is always
-|
. When you need to pass additional %options to the implied new(), then you must use an ARRAY for command name and its optional parameters.example:
my $mux = IOMux::Poll->new; $mux->open('-|', 'who', '-H'); # no opts $mux->open('-|', ['who', '-H'], %opts); $mux->open('-|', 'who'); # no opts $mux->open('-|', ['who'], %opts);
Accessors
Extends "Accessors" in IOMux::Handler::Read.
- $obj->childPid()
-
The process id of the child on the other side of the pipe.
- $obj->fh()
-
Inherited, see "Accessors" in IOMux::Handler
- $obj->fileno()
-
Inherited, see "Accessors" in IOMux::Handler
- $obj->mode()
-
The bits of the open mode.
- $obj->mux()
-
Inherited, see "Accessors" in IOMux::Handler
- $obj->name()
-
Inherited, see "Accessors" in IOMux::Handler
- $obj->readSize( [$integer] )
-
Inherited, see "Accessors" in IOMux::Handler::Read
- $obj->usesSSL()
-
Inherited, see "Accessors" in IOMux::Handler
User interface
Extends "User interface" in IOMux::Handler::Read.
Multiplexer
Extends "Multiplexer" in IOMux::Handler::Read.
Helpers
Extends "Helpers" in IOMux::Handler::Read.
- $obj->extractSocket(HASH)
- IOMux::Pipe::Read->extractSocket(HASH)
-
Inherited, see "Helpers" in IOMux::Handler
- $obj->fdset($state, $read, $write, $error)
-
Inherited, see "Helpers" in IOMux::Handler
- $obj->show()
-
Inherited, see "Helpers" in IOMux::Handler
SEE ALSO
This module is part of IOMux distribution version 1.01, built on January 15, 2020. Website: http://perl.overmeer.net/CPAN
LICENSE
Copyrights 2011-2020 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/