![]() |
![]()
| ![]() |
![]()
NAMEIO::Lambda::Signal - wait for pids and signals DESCRIPTIONThe module provides access to the signal-based callbacks: generic signal listener "signal", process ID listener "pid", and the asynchronous version of system call, "spawn". SYNOPSISuse strict; use IO::Lambda qw(:all); use IO::Lambda::Signal qw(pid spawn); # pid my $pid = fork; exec "/bin/ls" unless $pid; lambda { context $pid, 5; pid { my $ret = shift; print defined($ret) ? ("exitcode(", $ret>>8, ")\n") : "timeout\n"; } }-> wait; # spawn this lambda { context "perl -v"; spawn { my ( $buf, $exitcode, $error) = @_; print "buf=[$buf], exitcode=$exitcode, error=$error\n"; } }-> wait; USAGE
LIMITATION"pid" and "new_pid" don't work on win32 because win32 doesn't use SIGCHLD/waitpid. Native implementation of "spawn" and "new_process" doesn't work for the same reason on win32 as well, therefore those were reimplemented using threads, and require a threaded perl. SEE ALSOIO::Lambda, perlipc, IPC::Open2, IPC::Run AUTHORDmitry Karasik, <dmitry@karasik.eu.org>.
|