|
NAMEAnyEvent::Run - Run a process or coderef asynchronouslySYNOPSISuse AnyEvent; use AnyEvent::Run; my $cv = AnyEvent->condvar; my $handle = AnyEvent::Run->new( cmd => [ 'ls', '-l' ], priority => 19, # optional nice value on_read => sub { my $handle = shift; ... $cv->send; }, on_error => sub { my ($handle, $fatal, $msg) = @_; ... $cv->send; }, ); # Send data to the process's STDIN $handle->push_write($data); $cv->recv; DESCRIPTIONAnyEvent::Run is a subclass of AnyEvent::Handle, so reading it's documentation first is recommended.This module is designed to run a child process, using an explicit command line, a class name, or a coderef. It should work on any Unix system as well as Windows 2000 and higher. For an alternate way of running a coderef in a forked process using AnyEvent, see AnyEvent::Util's fork_call function. METHODS$handle = new( %args )Creates and returns a new AnyEvent::Run object. The process forks and either execs (Unix) or launches a new process (Windows). If using a coderef, the coderef is run in the forked process.The process's STDIN, STDOUT, and STDERR and connected to $handle->{fh}. The child process is automatically killed if the AnyEvent::Run object goes out of scope. See AnyEvent::Handle for additional parameters for new().
BUGSAnyEvent::Handle's linger option is not supported.Open file descriptors are not closed under Windows after forking. THANKSThis module was based in part on POE::Wheel::Run and POE::Wheel::Run::Win32.SEE ALSOAnyEvent AnyEvent::Handle AnyEvent::UtilAUTHORAndy Grundman, <andy@hybridized.org>COPYRIGHT AND LICENSEThis program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |