Process::Backgroundable - A Process::Storable object that can be backgrounded
# Background a finite length process MyCacheCleaner->new( dir => '...', maxsize => '10 meg' )->background; # Background an infinite length process MyWebServer->new( dir => '...' )->background;
Process::Backgroundable extends Process::Storable for the purpose of create process objects that can be run in the background and detached from the main process.
Process::Backgroundable
It adds a background method that (rather than fork), launches a new copy of Perl, passing the Process to it using Process::Launcher, which will load and execute the process.
background
Please note that both the STDOUT and STDERR for the backgrounded process will be sent to /dev/null (or your equivalent) so there is no way to recieve any output from the background process, and you will not be notified if it exits.
STDOUT
STDERR
If you want to add logging or locks or some other feature to your backgrounded process, that is your responsibility, and you set them up in the prepare method.
prepare
This method inherits all the normal methods from Process and in addition inherits the strict seperation of responsibility described in Process::Storable. You should be aware of both of these.
The background is provided by default, and will start another instance of the same Perl you are current running, although not necesarily with the same environment.
This allows you to use Process::Backgroundable in very large applications that may contain other data that will not be so amenable to normal forking.
This is implemented with IPC::Run3 calls for now, but we might have to move to Proc::Background for more robustness later on.
Bugs should be reported via the CPAN bug tracker at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Process-Backgroundable
For other issues, contact the author.
Adam Kennedy <adamk@cpan.org>
Copyright 2006 - 2008 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install Process::Backgroundable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Process::Backgroundable
CPAN shell
perl -MCPAN -e shell install Process::Backgroundable
For more information on module installation, please visit the detailed CPAN module installation guide.