Proc::PidChange - execute callbacks when PID changes
version 0.002
use Proc::PidChange; ## check for pid changes check_current_pid(); ## Registration of callbacks use Proc::PidChange ':all'; register_pid_change_callback(sub { ... });
This module provides a simple API to check if the process ID changed, due to a fork() call. If such change is detected, it calls all the registered callbacks.
The detection of PID changes can be done in two ways: in real-time as soon as it changes, or by calling "check_current_pid" on a regular basis. The real-time version requires the POSIX::AtFork module.
Interested parties should use the "register_pid_change_callback" to register a CodeRef to be called when the PID change is detected.
Given that real-time is the most efficient method to detect PID changes, we aggresively try to load POSIX::AtFork module and if found, enable real-time PID detection.
You can check to see if real-time detection is being used with the $Proc::PidChange::RT variable. If true, real-time detection is available.
$Proc::PidChange::RT
You can disable real-time detection by setting the PROC_PIDCHANGE_NO_RT environment to true before loading Proc::PidChange.
PROC_PIDCHANGE_NO_RT
Be aware that you should add POSIX::AtFork to your dependencies, this modules doesn't require it.
Check the current PID to see if it's changed. If yes, calls all registered callbacks.
Register one or more callbacks to be called when the PID change is detected.
If you register the same CodeRef callback twice, it will be called twice.
Unregister one or more callbacks.
POSIX::AtFork
You can find documentation for this module with the perldoc command.
perldoc Proc::PidChange
The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.
CPAN Testers
The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions.
http://www.cpantesters.org/distro/P/Proc-PidChange
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
http://matrix.cpantesters.org/?dist=Proc-PidChange
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
http://deps.cpantesters.org/?module=Proc::PidChange
CPAN Ratings
The CPAN Ratings is a website that allows community ratings and reviews of Perl modules.
http://cpanratings.perl.org/d/Proc-PidChange
You can email the author of this module at MELO at cpan.org asking for help with any problems you have.
MELO at cpan.org
Please report any bugs or feature requests by email to bug-proc-pidchange at rt.cpan.org, or through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Proc-PidChange. You will be automatically notified of any progress on the request by the system.
bug-proc-pidchange at rt.cpan.org
https://github.com/melo/Proc-PidChange
git clone https://github.com/melo/Proc-PidChange.git
Pedro Melo <melo@cpan.org>
This software is Copyright (c) 2012 by Pedro Melo.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Proc::PidChange, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Proc::PidChange
CPAN shell
perl -MCPAN -e shell install Proc::PidChange
For more information on module installation, please visit the detailed CPAN module installation guide.