NAME

XAS::Lib::Process - A class for managing processes within the XAS environment

SYNOPSIS

use XAS::Lib::Process;

my $process = XAS::Lib::Process->new(
   -command => 'perl test.pl'
);

$process->run();

DESCRIPTION

This class manages a sub process in a platform independent way. Mixins are loaded to handle the differences between Unix/Linux and Windows. This module inherits from XAS::Lib::POE::Service. Please refer to that module for additional help.

METHODS

new

This method initialized the module and takes the following parameters:

-auto_start

This indicates wither to auto start the process. The default is true.

-auto_restart

This indicates wither to auto restart the process if it exits. The default is true.

-command

The command to run.

-directory

The optional directory to start the process in. Defaults to the current directory of the parent process.

-environment

Optional, additional environment variables to provide to the process. The default is none.

-exit_codes

Optional exit codes to check for the process. They default to '0,1'. If the exit code matches, then the process is auto restarted. This should be a comma delimited list of values.

-exit_retries

The optional number of retries for restarting the process. The default is 5.

-group

The group to run the process under. Defaults to 'nobody'. This group may not be defined on your system. This option is not implemented on Windows.

-priority

The optional priority to run the process at. Defaults to 0. This option is not implemented on Windows.

-umask

The optional protection mask for the process. Defaults to '0022'. This option is not implemented on Windows.

-user

The optional user to run the process under. Defaults to 'nobody'. This user may not be defined on your system. This option is not implemented on Windows.

-redirect

This option is used to indicate wither to redirect stdout and stderr from the child process to the parent and stdin from the parent to the child process. The redirection combines stderr with stdout. Redirection is implemented using sockets. This may cause buffering problems with the child process.

The default is no.

-retry_delay

The optional number of seconds to delay a retry on an auto restart process. The default is 0, or no delay in restarting the process.

-input_driver

The optional input driver to use. Defaults to POE::Driver::SysRW.

-output_driver

The optional output driver to use. Defaults to POE::Driver::SysRW.

-input_filter

The optional filter to use for input. Defaults to POE::Filter::Line.

-output_filter

The optional output filter to use. Defaults to POE::Filter::Line.

-output_handler

This is an optional coderef to handle output from the process. The coderef takes one parameter, the output from the process.

METHODS

put($data)

This method will write a buffer to stdin.

SEE ALSO

XAS::Lib::Process::Unix
XAS::Lib::Process::Win32
XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

COPYRIGHT AND LICENSE

Copyright (c) 2012-2015 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.