NAME
Process::SubProcess::Group - Module to manage and run multiple Sub Processes at once
DESCRIPTION
Process::SubProcess::Group
implements a class to manage multiple Sub Process and run them at once while keeping their Output and Errors related to each command.
The Idea of this API is to launch Sub Processes and keep track of all Output on STDOUT
, STDERR
, the EXIT CODE
and possible System Errors at Launch Time in an object oriented manner.
CONSTRUCTOR
- new ( [ CONFIGURATIONS ] )
-
This is the constructor for a new SubProcess.
Parameters:
CONFIGURATIONS
are passed in a hash like fashion, using key and value pairs.Recognized Configurations:
check
- Time in seconds when to check a process for new output. This is calculated based on the count of processes to manage.read | readtimeout
- Time in seconds to wait for the process output. If the process is expected to run longer it is useful to set it to avoid excessive checks. It is also important for multiple process execusions, because other processes will not be checked before the read has not timed out.timeout
- Time in seconds to wait for the process to finish. After this time the process will be terminateddebug
- show internal processing informationquiet
- do not print any warnings or errors
Administration Methods
- add ( [ OBJECT | CLASS ] )
-
This method adds a Process object to the list of managed processes.
Parameters:
OBJECT | CLASS
- is aProcess::SubProcess
object or a compatible class name. If a class name or no parameter is given a new object will be created.Returns: It returns the object that was addded to list. If an object was given the same will be returned.
- setCheckInterval ( INTERVAL )
-
This method calculates the
READTIMEOUT
for eachProcess::SubProcess
object according to the amount of existing objects. The value of theREADTIMEOUT
for each Process will be rounded to a whole number.Example:
The Process Group manages 3 Processes. Processes "A", "B" and "C". Process "A" should be checked every 6 seconds. So, setting
setCheckInterval(6)
will set theREADTIMEOUT
of Processes "A", "B" and "C" to 2 seconds. This way after cycling over the processes the Process "A" will be checked again after 6 seconds.Parameters:
INTERVAL
- is an integer that specifies the interval in which each process should be checked.