The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XAS::Lib::Spawn - A class to spawn detached processes within the XAS environment

SYNOPSIS

 use XAS::Lib::Spawn;

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

DESCRIPTION

This class spawns a process to run in the back ground in a platform independent way. Mixins are loaded to handle the differences between Unix/Linux and Windows.

METHODS

new

This method initialized the module and takes the following parameters:

-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, addtional environmnet variables to provide to the process. The default is none.

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

run

Start the process. It returns the pid of that process.

status

Returns the status of the process. The status could be one of the follow:

6 - suspended ready
5 - suspended blocked
4 - blocked
3 - running
2 - ready
1 - other
0 - unknown

pause

Pause the process, returns 1 on success.

resume

Resume the process, returns 1 on success.

stop

Stop the process, returns 1 on success.

kill

Kill the process, returns 1 on success.

wait

Waits for the process to finish, returns 0 when the process is done. This method may return a -1 if the processes was reaped before the wait is called.

errorlevel

Returns the exit code of the process, or a -1 if the exit code is not available.

SEE ALSO

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

AUTHOR

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

COPYRIGHT AND LICENSE

Copyright (c) 2012-2016 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.