GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  IO::LAMBDA::SIGNAL (3)

.ds Aq ’

NAME

IO::Lambda::Signal - wait for pids and signals

CONTENTS

DESCRIPTION

The module provides access to the signal-based callbacks: generic signal listener signal, process ID listener pid, and the asynchronous version of system call, spawn.

SYNOPSIS



   use 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

pid ($PID, $TIMEOUT) -> $?|undef Accepts PID and an optional deadline/timeout, returns either the process’ exit status, or undef on timeout. The corresponding lambda is new_pid :



   new_pid ($PID, $TIMEOUT) :: () -> $?|undef



signal ($SIG, $TIMEOUT) -> boolean Accepts signal name and optional deadline/timeout, returns 1 if the signal was caught, or undef on timeout. The corresponding lambda is new_signal :



   new_signal ($SIG, $TIMEOUT) :: () -> boolean



spawn (@LIST) -> ( output, $?, $!) Calls pipe open on @LIST, reads all data printed by the child process, and awaits for the process to finish. Returns three scalars - collected output, process exitcode $?, and an error string (usually $!). The corresponding lambda is new_process :



   new_process (@LIST) :: () -> ( output, $?, $!)



Lambda objects created by new_process have an additional field pid initialized with the process pid value.

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 ALSO

IO::Lambda, perlipc, IPC::Open2, IPC::Run

AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 IO::LAMBDA::SIGNAL (3) 2012-03-14

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.