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 executed without any additional options.

OPTIONS - are passed in a hash like fashion, using key and value pairs. Combining the command with additional OPTIONS also requires the hash key command to be set.

See Method setArrProcess()

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.

See Method setArrProcess()

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 yet

timeout - Time in seconds to wait for the process to finish. After this time the process will be terminated

check | 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.

See Method setName()

See Method setCommand()

See Method setReadTimeout()

set ( CONFIGURATIONS )

Shorthand for setArrProcess()

See "Method setArrProcess()"

setName ( NAME )

This Method will asign a Name to the process.

This is useful when there are several processes with the same command running and a more prettier readable name is desired.

Parameters:

NAME - is a string that will be assigned as the process name.

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.

Parameters:

COMMAND - is a single scalar parameter that will be interpreted as command to executed

See "Method Launch()"

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.

See Method Launch()

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

See "Method Launch()"

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 process was launched correctly. otherwise it returns 0 .

See Method Check()

Check ()

This method checks whether the process is finished and calls the Read() method to read its output.

Returns: It returns 1 when the process is still running otherwise it returns 0 .

See Method Launch()