IO::Lambda::Signal(3)
okay bestie, welcome to the IO::Lambda::Signal(3) page in User Contributed Perl Documentation π
β¨ this is the whole vibe, group-chat edition.
π NAME π
IO::Lambda::Signal β the module that is literally here to wait for pids and signals π«Ά
πΈ DESCRIPTION πΈ
okay so this module provides access to the signal-based callbacks πβ¨ there are three main characters:
- the generic signal listener,
signalπ - the process ID listener,
pidπ¦ - and the asynchronous version of the system call,
spawnπ₯
no cap, that's the whole lineup.
β¨ SYNOPSIS β¨
bestie, here's the example code in all its glory π
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 a PID and an optional deadline/timeout, then returns either the process' exit status, orundefon timeout π the corresponding lambda isnew_pid:
new_pid ($PID, $TIMEOUT) :: () -> $?|undef
signal ($SIG, $TIMEOUT) -> booleanβ accepts a signal name and an optional deadline/timeout, returns1if the signal was caught, orundefon timeout π«Ά the corresponding lambda isnew_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 isnew_process:
new_process (@LIST) :: () -> ( output, $?, $!)
Lambda objects created by new_process have an additional field 'pid' initialized with the process pid value π¦
π LIMITATION π
π¨ no cap, this caveat matters:pidandnew_piddon't work on win32 because win32 doesn't useSIGCHLD/waitpid. native implementation ofspawnandnew_processdoesn't work for the same reason on win32 as well, therefore those were reimplemented using threads, and require a threaded perl. periodt. π
π₯ SEE ALSO π₯
go check out these icons too: IO::Lambda, perlipc, IPC::Open2, IPC::Run π
π AUTHOR π
Dmitry Karasik, <dmitry@karasik.eu.org> π
mwah π that's the whole page β it's from perl v5.42.2, dated 2026-02-15, and it lives under IO::Lambda::Signal(3) πβ¨
π¦ where this page comes from
- alpine 3.24: perl-io-lambda-doc 1.34-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms