This module provides access to extended Win32 process creation and management abilities. Process objects are created with the Create method (the constructor). Additional methods can be used on objects to kill, suspend, resume, and set the priorities of processes.
The Create constructor has the following syntax:
Win32::Process->Create($Proc, app, cmnd, hndls, opts, dir)
The arguments to Create are as follows:
The process is created by passing the command line in cmnd to the executable named in app. For example, a process object for a text file running in Notepad is created like this:
use Win32::Process; Win32::Process->Create($proc, 'C:\\windows\\Notepad.exe', "Notepad perlnut.txt", 1, DETACHED_PROCESS, ".");
The process creation options given by the opts argument to Create are:
The following methods are provided for objects of created by Win32::Process.
GetPriorityClass |
$proc->GetPriorityClass($ref)
Gets the priority class of the process and stores it in $ref.
Kill |
$proc->Kill(exitcode)
Kills the process with the given exitcode, which is returned by the process.
Resume |
$proc->Resume
Resumes a suspended process. This method can also be used on processes created with the CREATE_SUSPENDED flag.
SetPriorityClass |
$proc->SetPriorityClass($priority)
Sets the priority class of the object to $priority. The priority can be one of the following:
Copyright © 2002 O'Reilly & Associates. All rights reserved.