NAME
Process::SubProcess - Library to manage Sub Processes as Objects
DESCRIPTION
Process::SubProcess
implements a Class to manage a Sub Process and read its Output and Errors
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. This allows an easy aggregation and thus the creation of Sub Process Groups and Sub Process Pools for simultaneous execution of multiple Sub Processes while keeping the execution logs separated.
STATIC METHODS
- runSubProcess ( [ COMMAND | OPTIONS ] )
-
This creates adhoc an
Process::SubProcess
Object and runs the command given as string.COMMAND
- is a single scalar parameter will be interpreted as command to execute without any additional options.OPTIONS
- are passed in a hash like fashion, using key and value pairs. Combining the command with additionalOPTIONS
also requires the hash keycommand
to be set.
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.
Administration Methods
- setArrProcess ( CONFIGURATIONS )
-
This Method will asign Values to physically Data Fields.
Parameters:
CONFIGURATIONS
- is a list are passed in a hash like fashion, using key and value pairs.Recognized Configurations:
name
- is a string that will be assigned as the process name. This is useful when there are several processes with the same command running and a more prettier readable name is desired.command
- The command that has to be executed. It only can be set if the process is not running yettimeout
- Time in seconds to wait for the process to finish. After this time the process will be terminatedcheck | 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.
- setName ( NAME )
-
This Method will asign a Name to the process.
Parameters:
NAME
- is a string that will be assigned as the process name. This is useful when there are several processes with the same command running and a more prettier readable name is desired.
- setCommand ( COMMAND )
-
This method sets the
COMMAND
property as string that represents the command to be executed.It can only be set when the Sub Process is not running.
- setReadTimeout ( TIMEOUT )
-
This method sets the
READTIMEOUT
property as numeric value that represents the 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. It can only be set when the Sub Process is not running.
- setTimeout ( TIMEOUT )
-
This method sets the
EXECUTIONTIMEOUT
property as numeric value that represents the Time in seconds to wait for the process to finish. After this time the process will be terminated.The
EXECUTIONTIMEOUT
property must be a positive numeric value. Setting it to a negative value-1
will disable the Execution Timeout
- Launch ()
-
This method starts the process. It will create a Sub Process from the defined
COMMAND
Property.Per default this the process runs asynchronously. The Wait() method is used to monitor its execution and read its outputs
Returns: It returns
1
when the indices and aliases are created and verified as correct. Otherwise it returns0
.See "Method
Wait()
"