Dmitriy Shamatrin
and 1 contributors

NAME

System::Process

DESCRIPTION

Manipulate system process as perl object. This is a simple wrapper over ps on *nix systems. For Windows systems - under construction.

SYNOPSIS

    use System::Process;

    my $process_object = pidinfo pid => 5321;
    if ($process_object) {
        print $process_object->command();
    }

METHODS

pidinfo

pidinfo(%)

params is hash (pid=>4444) || (file=>'/path/to/pid/file' || pattern => 'my\scool\sname')

returns System::Process::Unit object that supports following methods if pid or file option specified. If pattern option specified - returns arrayref of System::Process objects.

PROCESS OBJECT METHODS

If your ps uax header simillar to my: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND You will get these methods:

cpu

Returns %CPU.

time

Returns TIME.

stat

Returns STAT.

tty

Returns TTY.

user

Returns USER

mem

Returns %MEM

rss

Returns %RSS

vsz

Returns VSZ

command

Returns COMMAND

start

Returns START

pid

Returns PID

Anyway, you will get methods named as lowercase header values.

cankill

Checks possibility of 'kill' process. Returns 1 if possible

kill

Kills a process with specified signal $process_object->kill(9);

refresh

Refreshes data for current pid.

write_pid

Writes pid to desired file. $process_object->write_pid('/my/pid/path');

is_alive

Returns true if process alive.