AnyEvent-Proc
view release on metacpan or search on metacpan
lib/AnyEvent/Proc.pm view on Meta::CPAN
=head2 stop_timeout()
Stopps read/write timeout for STDIN, STDOUT and STDERR.
See I<timeout> and I<on_timeout> options in I<new()>.
=head2 stop_wtimeout()
Stopps write timeout for STDIN.
See I<wtimeout> and I<on_wtimeout> options in I<new()>.
=head2 stop_rtimeout()
Stopps read timeout for STDIN.
See I<rtimeout> and I<on_rtimeout> options in I<new()>.
=head2 stop_etimeout()
Stopps read timeout for STDIN.
See I<etimeout> and I<on_etimeout> options in I<new()>.
=head2 write($scalar)
Queues the given scalar to be written.
=head2 write($type => @args)
See L<AnyEvent::Handle>::push_write for more information.
=head2 writeln(@lines)
Queues one or more line to be written.
=head2 pipe([$fd, ]$peer)
Pipes any output of STDOUT to another handle. C<$peer> maybe another L<AnyEvent::Proc> instance, an L<AnyEvent::Handle>, a L<Coro::Channel>, an object that implements the I<print> method (like L<IO::Handle>, including any subclass), a ScalarRef or a ...
C<$fd> defaults to I<stdout>.
$proc->pipe(stderr => $socket);
=head2 pull($peer)
Pulls any data from another handle to STDIN. C<$peer> maybe another L<AnyEvent::Proc> instance, an L<AnyEvent::Handle>, an L<IO::Handle> (including any subclass), a L<Coro::Channel>, a ScalarRef or a GlobRef.
$proc->pull($socket);
=head2 readline_cb($callback)
Reads a single line from STDOUT and calls C<$callback>
=head2 readline_cv([$condvar])
Reads a single line from STDOUT and send the result to C<$condvar>. A condition variable will be created and returned, if C<$condvar> is omitted.
=head2 readline_ch([$channel])
Reads a singe line from STDOUT and put the result to coro channel C<$channel>. A L<Coro::Channel> will be created and returned, if C<$channel> is omitted.
=head2 readlines_cb($callback)
Read lines continiously from STDOUT and calls on every line the handler C<$callback>.
=head2 readlines_ch([$channel])
Read lines continiously from STDOUT and put every line to coro channel C<$channel>. A L<Coro::Channel> will be created and returned, if C<$channel> is omitted.
=head2 readline()
Reads a single line from STDOUT synchronously and return the result.
Same as
$proc->readline_cv->recv
=head2 readline_error_cb($callback)
Bevahes equivalent as I<readline_cb>, but for STDERR.
=head2 readline_error_cv([$condvar])
Bevahes equivalent as I<readline_cv>, but for STDERR.
=head2 readline_error_ch([$channel])
Bevahes equivalent as I<readline_ch>, but for STDERR.
=head2 readlines_error_cb($callback)
Bevahes equivalent as I<readlines_cb>, but for STDERR.
=head2 readlines_error_ch([$channel])
Bevahes equivalent as I<readlines_ch>, but for STDERR.
=head2 readline_error()
Bevahes equivalent as I<readline>, but for STDERR.
=head1 FUNCTIONS
=head2 reader()
Creates a new file descriptor for pulling data from process.
use AnyEvent::Proc qw(reader);
my $reader = reader();
my $proc = AnyEvent::Proc->new(
bin => '/bin/sh',
args => [ -c => "echo hi >&$reader" ] # overloads to fileno
extras => [ $reader ], # unordered list of all extra descriptors
);
my $out;
$reader->pipe(\$out);
$proc->wait;
# $out contains now 'hi'
This calls C<< /bin/sh -c "echo hi >&3" >>, so that any output will be dupped into fd #3.
C<$reader> provides following methods:
=over 4
=item * L</on_timeout>
=item * L</stop_timeout>
( run in 0.940 second using v1.01-cache-2.11-cpan-df04353d9ac )