NAME
IOMux::Pipe::Write - write to an external command
INHERITANCE
IOMux::Pipe::Write
is an IOMux::Handler::Write
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::Write;
my $pipe = IOMux::Pipe::Write->new
(command => [$command, @cmd_options]);
$mux->add($pipe);
$pipe->write($text);
$pipe->print($text);
write $pipe $text;
print $pipe $text;
DESCRIPTION
In an event driven program, you must be careful with every Operation System call, because it can block the event mechanism, hence the program as a whole. Often you can be lazy with writes, because its communication buffers are usually working quite asynchronous... but not always. You may skip the callbacks for small writes and prints.
Extends "DESCRIPTION" in IOMux::Handler::Write.
METHODS
Extends "METHODS" in IOMux::Handler::Write.
Constructors
Extends "Constructors" in IOMux::Handler::Write.
- IOMux::Pipe::Write->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 read handle to be connected to the other side.
All %options which are available to IOMux::Handler::Write::new() can be used here as well.
-Option --Default read_size 4096
example:
my ($in, $in_rh) = IOMux::Pipe::Write->bare(name => 'stdin');
- IOMux::Pipe::Write->new(%options)
-
-Option --Defined in --Default command <required> fh IOMux::Handler <required> name IOMux::Handler '|$cmd' write_size IOMux::Handler::Write 4096
- IOMux::Pipe::Write->open( $mode, <$cmd, $cmdopts>|<$cmdarray, %options> )
-
Open the pipe to write. $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('|-', 'lpr', '-#4'); # no opts $mux->open('|-', ['lpr', '-#4'], %opts); $mux->open('|-', 'lpr'); # no opts $mux->open('|-', ['lpr'], %opts);
Accessors
Extends "Accessors" in IOMux::Handler::Write.
- $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->usesSSL()
-
Inherited, see "Accessors" in IOMux::Handler
- $obj->writeSize( [$integer] )
-
Inherited, see "Accessors" in IOMux::Handler::Write
User interface
Extends "User interface" in IOMux::Handler::Write.
Multiplexer
Extends "Multiplexer" in IOMux::Handler::Write.
Helpers
Extends "Helpers" in IOMux::Handler::Write.
- $obj->extractSocket(HASH)
- IOMux::Pipe::Write->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/