perl 5.003_02: [no incremental changelog available]
[p5sagit/p5-mst-13.2.git] / os2 / OS2 / Process / Process.pm
1 package OS2::Process;
2
3 require Exporter;
4 require DynaLoader;
5 require AutoLoader;
6
7 @ISA = qw(Exporter DynaLoader);
8 # Items to export into callers namespace by default. Note: do not export
9 # names by default without a very good reason. Use EXPORT_OK instead.
10 # Do not simply export all your public functions/methods/constants.
11 @EXPORT = qw(
12         P_BACKGROUND
13         P_DEBUG
14         P_DEFAULT
15         P_DETACH
16         P_FOREGROUND
17         P_FULLSCREEN
18         P_MAXIMIZE
19         P_MINIMIZE
20         P_NOCLOSE
21         P_NOSESSION
22         P_NOWAIT
23         P_OVERLAY
24         P_PM
25         P_QUOTE
26         P_SESSION
27         P_TILDE
28         P_UNRELATED
29         P_WAIT
30         P_WINDOWED
31 );
32 sub AUTOLOAD {
33     # This AUTOLOAD is used to 'autoload' constants from the constant()
34     # XS function.  If a constant is not found then control is passed
35     # to the AUTOLOAD in AutoLoader.
36
37     local($constname);
38     ($constname = $AUTOLOAD) =~ s/.*:://;
39     $val = constant($constname, @_ ? $_[0] : 0);
40     if ($! != 0) {
41         if ($! =~ /Invalid/) {
42             $AutoLoader::AUTOLOAD = $AUTOLOAD;
43             goto &AutoLoader::AUTOLOAD;
44         }
45         else {
46             ($pack,$file,$line) = caller;
47             die "Your vendor has not defined OS2::Process macro $constname, used at $file line $line.
48 ";
49         }
50     }
51     eval "sub $AUTOLOAD { $val }";
52     goto &$AUTOLOAD;
53 }
54
55 bootstrap OS2::Process;
56
57 # Preloaded methods go here.
58
59 # Autoload methods go after __END__, and are processed by the autosplit program.
60
61 1;
62 __END__
63
64 =head1 NAME
65
66 OS2::Process - exports constants for system() call on OS2.
67
68 =head1 SYNOPSIS
69
70     use OS2::Process;
71     $pid = system(P_PM+P_BACKGROUND, "epm.exe");
72
73 =head1 DESCRIPTION
74
75 the builtin function system() under OS/2 allows an optional first
76 argument which denotes the mode of the process. Note that this argument is
77 recognized only if it is strictly numerical.
78
79 You can use either one of the process modes:
80
81         P_WAIT (0)      = wait until child terminates (default)
82         P_NOWAIT        = do not wait until child terminates
83         P_SESSION       = new session
84         P_DETACH        = detached
85         P_PM            = PM program
86
87 and optionally add PM and session option bits:
88
89         P_DEFAULT (0)   = default
90         P_MINIMIZE      = minimized
91         P_MAXIMIZE      = maximized
92         P_FULLSCREEN    = fullscreen (session only)
93         P_WINDOWED      = windowed (session only)
94
95         P_FOREGROUND    = foreground (if running in foreground)
96         P_BACKGROUND    = background
97
98         P_NOCLOSE       = don't close window on exit (session only)
99
100         P_QUOTE         = quote all arguments
101         P_TILDE         = MKS argument passing convention
102         P_UNRELATED     = do not kill child when father terminates
103
104 =head1 AUTHOR
105
106 Andreas Kaiser <ak@ananke.s.bawue.de>.
107
108 =head1 SEE ALSO
109
110 C<spawn*>() system calls.
111
112 =cut