home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _1335eea3c1994a06c1429fcf76faec82 < prev    next >
Text File  |  2000-03-15  |  4KB  |  155 lines

  1. package Win32::Process;
  2.  
  3. require Exporter;
  4. require DynaLoader;
  5. @ISA = qw(Exporter DynaLoader);
  6.  
  7. $VERSION = '0.06';
  8.  
  9. # Items to export into callers namespace by default. Note: do not export
  10. # names by default without a very good reason. Use EXPORT_OK instead.
  11. # Do not simply export all your public functions/methods/constants.
  12. @EXPORT = qw(
  13.     CREATE_DEFAULT_ERROR_MODE
  14.     CREATE_NEW_CONSOLE
  15.     CREATE_NEW_PROCESS_GROUP
  16.     CREATE_NO_WINDOW
  17.     CREATE_SEPARATE_WOW_VDM
  18.     CREATE_SUSPENDED
  19.     CREATE_UNICODE_ENVIRONMENT
  20.     DEBUG_ONLY_THIS_PROCESS
  21.     DEBUG_PROCESS
  22.     DETACHED_PROCESS
  23.     HIGH_PRIORITY_CLASS
  24.     IDLE_PRIORITY_CLASS
  25.     INFINITE
  26.     NORMAL_PRIORITY_CLASS
  27.     REALTIME_PRIORITY_CLASS
  28.     THREAD_PRIORITY_ABOVE_NORMAL
  29.     THREAD_PRIORITY_BELOW_NORMAL
  30.     THREAD_PRIORITY_ERROR_RETURN
  31.     THREAD_PRIORITY_HIGHEST
  32.     THREAD_PRIORITY_IDLE
  33.     THREAD_PRIORITY_LOWEST
  34.     THREAD_PRIORITY_NORMAL
  35.     THREAD_PRIORITY_TIME_CRITICAL
  36. );
  37.  
  38. sub AUTOLOAD {
  39.     # This AUTOLOAD is used to 'autoload' constants from the constant()
  40.     # XS function.
  41.     my($constname);
  42.     ($constname = $AUTOLOAD) =~ s/.*:://;
  43.     my $val = constant($constname);
  44.     if ($! != 0) {
  45.         my ($pack,$file,$line) = caller;
  46.         die "Your vendor has not defined Win32::Process macro $constname, used at $file line $line.";
  47.     }
  48.     eval "sub $AUTOLOAD { $val }";
  49.     goto &$AUTOLOAD;
  50. } # end AUTOLOAD
  51.  
  52. bootstrap Win32::Process;
  53.  
  54. 1;
  55. __END__
  56.  
  57. =head1 NAME
  58.  
  59. Win32::Process - Create and manipulate processes.
  60.  
  61. =head1 SYNOPSIS
  62.     use Win32::Process;
  63.     use Win32;
  64.  
  65.     sub ErrorReport{
  66.         print Win32::FormatMessage( Win32::GetLastError() );
  67.     }
  68.  
  69.     Win32::Process::Create($ProcessObj,
  70.                 "D:\\winnt35\\system32\\notepad.exe",
  71.                 "notepad temp.txt",
  72.                 0,
  73.                 NORMAL_PRIORITY_CLASS,
  74.                 ".")|| die ErrorReport();
  75.  
  76.     $ProcessObj->Suspend();
  77.     $ProcessObj->Resume();
  78.     $ProcessObj->Wait(INFINITE);
  79.  
  80. =head1  DESCRIPTION
  81.  
  82. This module allows for control of processes in Perl.
  83.  
  84. =head1 METHODS
  85.  
  86. =over 8
  87.  
  88. =item Win32::Process::Create($obj,$appname,$cmdline,$iflags,$cflags,$curdir)
  89.  
  90. Creates a new process.
  91.  
  92.     Args:
  93.  
  94.     $obj        container for process object
  95.     $appname    full path name of executable module
  96.     $cmdline    command line args
  97.     $iflags        flag: inherit calling processes handles or not
  98.     $cflags        flags for creation (see exported vars below)
  99.     $curdir        working dir of new process
  100.  
  101. =item Win32::Process::KillProcess($pid, $exitcode)
  102.  
  103. Terminates any process identified by $pid.  The process will exit
  104. with $exitcode.
  105.  
  106. =item $ProcessObj->Suspend()
  107.  
  108. Suspend the process associated with the $ProcessObj.
  109.  
  110. =item $ProcessObj->Resume()
  111.  
  112. Resume a suspended process.
  113.  
  114. =item $ProcessObj->Kill( $ExitCode )
  115.  
  116. Kill the associated process, have it die with exit code $ExitCode.
  117.  
  118. =item $ProcessObj->GetPriorityClass($class)
  119.  
  120. Get the priority class of the process.
  121.  
  122. =item $ProcessObj->SetPriorityClass( $class )
  123.  
  124. Set the priority class of the process (see exported values below for
  125. options).
  126.  
  127. =item $ProcessObj->GetProcessAffinitymask( $processAffinityMask, $systemAffinitymask)
  128.  
  129. Get the process affinity mask.  This is a bitvector in which each bit
  130. represents the processors that a process is allowed to run on.
  131.  
  132. =item $ProcessObj->SetProcessAffinitymask( $processAffinityMask )
  133.  
  134. Set the process affinity mask.  Only available on Windows NT.
  135.  
  136. =item $ProcessObj->GetExitCode( $ExitCode )
  137.  
  138. Retrieve the exitcode of the process.
  139.  
  140. =item $ProcessObj->Wait($Timeout)
  141.  
  142. Wait for the process to die. forever = INFINITE
  143.  
  144. =item $ProcessObj->GetProcessID()
  145.  
  146. Returns the Process ID.
  147.  
  148. =back
  149.  
  150. =cut
  151.  
  152. # Local Variables:
  153. # tmtrack-file-task: "Win32::Process"
  154. # End:
  155.