9 @ISA = qw(Exporter DynaLoader);
10 # Items to export into callers namespace by default. Note: do not export
11 # names by default without a very good reason. Use EXPORT_OK instead.
12 # Do not simply export all your public functions/methods/constants.
51 # This AUTOLOAD is used to 'autoload' constants from the constant()
52 # XS function. If a constant is not found then control is passed
53 # to the AUTOLOAD in AutoLoader.
56 ($constname = $AUTOLOAD) =~ s/.*:://;
57 $val = constant($constname, @_ ? $_[0] : 0);
59 if ($! =~ /Invalid/) {
60 $AutoLoader::AUTOLOAD = $AUTOLOAD;
61 goto &AutoLoader::AUTOLOAD;
64 ($pack,$file,$line) = caller;
65 die "Your vendor has not defined OS2::Process macro $constname, used at $file line $line.
69 eval "sub $AUTOLOAD { $val }";
73 bootstrap OS2::Process;
75 # Preloaded methods go here.
77 sub get_title () { (process_entry())[0] }
79 # Autoload methods go after __END__, and are processed by the autosplit program.
86 OS2::Process - exports constants for system() call on OS2.
91 $pid = system(P_PM+P_BACKGROUND, "epm.exe");
95 the builtin function system() under OS/2 allows an optional first
96 argument which denotes the mode of the process. Note that this argument is
97 recognized only if it is strictly numerical.
99 You can use either one of the process modes:
101 P_WAIT (0) = wait until child terminates (default)
102 P_NOWAIT = do not wait until child terminates
103 P_SESSION = new session
107 and optionally add PM and session option bits:
109 P_DEFAULT (0) = default
110 P_MINIMIZE = minimized
111 P_MAXIMIZE = maximized
112 P_FULLSCREEN = fullscreen (session only)
113 P_WINDOWED = windowed (session only)
115 P_FOREGROUND = foreground (if running in foreground)
116 P_BACKGROUND = background
118 P_NOCLOSE = don't close window on exit (session only)
120 P_QUOTE = quote all arguments
121 P_TILDE = MKS argument passing convention
122 P_UNRELATED = do not kill child when father terminates
124 =head2 Access to process properties
126 Additionaly, subroutines my_type(), process_entry() and
127 C<file_type(file)>, get_title() and C<set_title(newtitle)> are implemented.
128 my_type() returns the type of the current process (one of
129 "FS", "DOS", "VIO", "PM", "DETACH" and "UNKNOWN"), or C<undef> on error.
133 =item C<file_type(file)>
135 returns the type of the executable file C<file>, or
136 dies on error. The bits 0-2 of the result contain one of the values
140 =item C<T_NOTSPEC> (0)
142 Application type is not specified in the executable header.
144 =item C<T_NOTWINDOWCOMPAT> (1)
146 Application type is not-window-compatible.
148 =item C<T_WINDOWCOMPAT> (2)
150 Application type is window-compatible.
152 =item C<T_WINDOWAPI> (3)
154 Application type is window-API.
158 The remaining bits should be masked with the following values to
159 determine the type of the executable:
165 Set to 1 if the executable file has been "bound" (by the BIND command)
166 as a Family API application. Bits 0, 1, and 2 still apply.
168 =item C<T_DLL> (0x10)
170 Set to 1 if the executable file is a dynamic link library (DLL)
171 module. Bits 0, 1, 2, 3, and 5 will be set to 0.
173 =item C<T_DOS> (0x20)
175 Set to 1 if the executable file is in PC/DOS format. Bits 0, 1, 2, 3,
176 and 4 will be set to 0.
178 =item C<T_PHYSDRV> (0x40)
180 Set to 1 if the executable file is a physical device driver.
182 =item C<T_VIRTDRV> (0x80)
184 Set to 1 if the executable file is a virtual device driver.
186 =item C<T_PROTDLL> (0x100)
188 Set to 1 if the executable file is a protected-memory dynamic link
191 =item C<T_32BIT> (0x4000)
193 Set to 1 for 32-bit executable files.
197 file_type() may croak with one of the strings C<"Invalid EXE
198 signature"> or C<"EXE marked invalid"> to indicate typical error
199 conditions. If given non-absolute path, will look on C<PATH>, will
200 add extention F<.exe> if no extension is present (add extension F<.>
203 =item process_entry()
205 returns a list of the following data:
211 Title of the process (in the C<Ctrl-Esc> list);
215 window handle of switch entry of the process (in the C<Ctrl-Esc> list);
219 window handle of the icon of the process;
223 process handle of the owner of the entry in C<Ctrl-Esc> list;
227 process id of the owner of the entry in C<Ctrl-Esc> list;
231 session id of the owner of the entry in C<Ctrl-Esc> list;
235 whether visible in C<Ctrl-Esc> list;
239 whether item cannot be switched to (note that it is not actually
240 grayed in the C<Ctrl-Esc> list));
244 whether participates in jump sequence;
248 program type. Possible values are:
257 Although there are several other program types for WIN-OS/2 programs,
258 these do not show up in this field. Instead, the PROG_VDM or
259 PROG_WINDOWEDVDM program types are used. For instance, for
260 PROG_31_STDSEAMLESSVDM, PROG_WINDOWEDVDM is used. This is because all
261 the WIN-OS/2 programs run in DOS sessions. For example, if a program
262 is a windowed WIN-OS/2 program, it runs in a PROG_WINDOWEDVDM
263 session. Likewise, if it's a full-screen WIN-OS/2 program, it runs in
269 =item C<set_title(newtitle)>
271 - does not work with some windows (if the title is set from the start).
272 This is a limitation of OS/2, in such a case $^E is set to 372 (type
276 for a funny - and wrong - explanation ;-).
280 is a shortcut implemented via process_entry().
286 Andreas Kaiser <ak@ananke.s.bawue.de>,
287 Ilya Zakharevich <ilya@math.ohio-state.edu>.
291 C<spawn*>() system calls.