NAME
IPC::PidStat - Process ID existance test
SYNOPSIS
use IPC::PidStat;
my $exister = new IPC::PidStat(
port=>1234,
exists_cb=>sub {print "Pid $_[1] ",($_[2]?'exists':'dead'); },
);
$exister->pid_request(host=>'foo', pid=>$pid)
DESCRIPTION
IPC::PidStat
allows remote requests to be made to the pidstatd
, to determine if a PID is running on the daemon's machine.
PidStat uses UDP, and as such results are fast but may be unreliable. Furthermore, the pidstatd may not even be running on the remote machine, so responses should never be required before an application program makes progress.
METHODS
- new ([parameter=>value ...]);
-
Creates a new object for later use. See the PARAMETERS section.
- pid_request (host=>$host, pid=>$pid);
-
Sends a request to the specified host's server to see if the specified PID exists.
- pid_request_recv (host=>$host, pid=>$pid);
-
Calls pid_request and returns the recv_stat reply. If the response fails to return in one second, it is retried up to 5 times, then undef is returned.
- recv_stat()
-
Blocks waiting for any return from the server. Returns undef if none is found, or a 2 element array with the PID and existance flag. Generally this would be called inside a IO::Select loop.
STATIC METHODS
- local_pid_doesnt_exist(<pid>)
-
Static call, not a method call. Return 0 if a pid exists, 1 if not. Return undef if it can't be determined.
- local_pid_exists(<pid>)
-
Static call, not a method call. Return 1 if a pid exists, 0 if not. Return undef if it can't be determined.
PARAMETERS
- port
-
The port number (INET) of the pidstatd server. Defaults to 'pidstatd' looked up via /etc/services, else 1752.
SEE ALSO
pidstatd
, pidwatch
, IPC::Locker
,
DISTRIBUTION
This package is distributed via CPAN.
AUTHORS
Wilson Snyder <wsnyder@wsnyder.org>