IPC::PidStat - Process ID existence test


  use IPC::PidStat;

  my $exister = new IPC::PidStat(
  $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;


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.


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.

The optional parameters return_exist=>0, return_doesnt=>0 and return_unknown=>0 improve performance by suppressing return messages if the specified pid exists, doesn't exist, or has unknown state respectively. Pidstatd versions before 1.480 ignore this flag, so the return code from recv_stat should not assume the undesired return types will be suppressed.

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.


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::Poll loop.



Static call, not a method call. Return 0 if a pid exists, 1 if not. Return undef if it can't be determined.


Static call, not a method call. Return 1 if a pid exists, 0 if not. Return undef if it can't be determined.



The port number (INET) of the pidstatd server. Defaults to 'pidstatd' looked up via /etc/services, else 1752.


The latest version is available from CPAN and from

Copyright 2002-2022 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 Version 3 or the Perl Artistic License Version 2.0.


Wilson Snyder <>


IPC::Locker, pidstat, pidstatd, pidwatch