NAME
IPC::PidStat - Process ID existence test
SYNOPSIS
use IPC::PidStat;
my $exister = new IPC::PidStat(
port=>1234,
);
$exister->pid_request(host=>'foo', pid=>$pid)
while (1) { # Poll receiving callbacks
my ($epid, $eexists, $ehostname) = $exister->recv_stat();
print "Pid $epid ",($eexists?'exists':'dead'),"\n" if $ehostname;
}
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 existence 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.
DISTRIBUTION
The latest version is available from CPAN and from http://www.veripool.com/.
Copyright 2002-2007 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License or the Perl Artistic License.
AUTHORS
Wilson Snyder <wsnyder@wsnyder.org>