AnyEvent-Proc

 view release on metacpan or  search on metacpan

lib/AnyEvent/Proc.pm  view on Meta::CPAN

Kills the subprocess the most brutal way. Equals to

	$proc->fire('kill')

=head2 fire_and_kill([$signal, ]$time[, $callback])

Fires specified signal C<$signal> (or I<TERM> if omitted) and after C<$time> seconds kills the subprocess.

See L</wait> for the meaning of the callback parameter and return value.

Without calllback, this is a synchronous call. After this call, the subprocess can be considered to be dead. Returns the exit code of the subprocess.

=head2 alive()

Check whether is subprocess is still alive. Returns I<1> or I<0>

In fact, the method equals to

	$proc->fire(0)

=head2 wait([$callback])

Waits for the subprocess to be finished call the callback with the exit code. Returns a condvar.

Without callback, this is a synchronous call directly returning the exit code.

=head2 finish()

Closes STDIN of subprocess

=head2 end()

Closes all handles of subprocess

=head2 stop_timeout()

lib/AnyEvent/Proc.pm  view on Meta::CPAN

=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])

lib/AnyEvent/Proc.pm  view on Meta::CPAN

In list context, STDOUT and STDERR will be separately returned.

	($out, $err) = AnyEvent::Proc::run(...)

The exit-code is stored in C<$?>. Please keep in mind that for portability reasons C<$?> is shifted by 8 bits.

	$exitcode = $? >> 8

=head2 run_cb($bin[, @args], $callback)

Like L</run>, but asynchronous with callback handler. Returns the condvar. See L</wait> for more information.

	AnyEvent::Proc::run_cb($bin, @args, sub {
		my ($out, $err, $status) = @_;
		...;
	});

=head1 LIMITATIONS

Use L<EV>. The fallback module L<AnyEvent::Impl::Perl> has some issues with pipes. In some cases, L<AnyEvent::Handle> don't receive data from its pipe peer and the application will block forever. I haven't a solution yet, so don't rely on pipes when ...



( run in 0.228 second using v1.01-cache-2.11-cpan-0d8aa00de5b )