AnyEvent-Fork

 view release on metacpan or  search on metacpan

Fork/Serve.pm  view on Meta::CPAN

   local *run_args = sub () { # AnyEvent::Fork::Serve::run_args
      my (@ret, @arg) = @arg; # copy and clear @arg
      @ret
   };

   while () {
      # we manually reap child processes before we sleep, as local $SIG...
      # will destroy existing child handlers instead of restoring them.
      1 while 0 < waitpid -1, 1; # WNOHANG is portably 1. prove me wrong.

      # we must not ever read "too much" data, as we might accidentally read
      # an IO::FDPass::send request.

      my $len;
      sysread $master, $len, 5 - length $len, length $len or last
         while 5 > length $len;
      ($cmd, $len) = unpack "a L", $len;

      my $buf;
      sysread $master, $buf, $len - length $buf, length $buf or last
         while $len > length $buf;



( run in 1.004 second using v1.01-cache-2.11-cpan-de7293f3b23 )