Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "PERLOS2 1" | |
132 | .TH PERLOS2 1 "2006-01-07" "perl v5.8.8" "Perl Programmers Reference Guide" | |
133 | .SH "NAME" | |
134 | perlos2 \- Perl under OS/2, DOS, Win0.3*, Win0.95 and WinNT. | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | One can read this document in the following formats: | |
138 | .PP | |
139 | .Vb 4 | |
140 | \& man perlos2 | |
141 | \& view perl perlos2 | |
142 | \& explorer perlos2.html | |
143 | \& info perlos2 | |
144 | .Ve | |
145 | .PP | |
146 | to list some (not all may be available simultaneously), or it may | |
147 | be read \fIas is\fR: either as \fI\s-1README\s0.os2\fR, or \fIpod/perlos2.pod\fR. | |
148 | .PP | |
149 | To read the \fI.INF\fR version of documentation (\fBvery\fR recommended) | |
150 | outside of \s-1OS/2\s0, one needs an \s-1IBM\s0's reader (may be available on \s-1IBM\s0 | |
151 | ftp sites (?) (\s-1URL\s0 anyone?)) or shipped with \s-1PC\s0 \s-1DOS\s0 7.0 and \s-1IBM\s0's | |
152 | Visual Age \*(C+ 3.5. | |
153 | .PP | |
154 | A copy of a Win* viewer is contained in the \*(L"Just add \s-1OS/2\s0 Warp\*(R" package | |
155 | .PP | |
156 | .Vb 1 | |
157 | \& ftp://ftp.software.ibm.com/ps/products/os2/tools/jaow/jaow.zip | |
158 | .Ve | |
159 | .PP | |
160 | in \fI?:\eJUST_ADD\eview.exe\fR. This gives one an access to \s-1EMX\s0's | |
161 | \&\fI.INF\fR docs as well (text form is available in \fI/emx/doc\fR in | |
162 | \&\s-1EMX\s0's distribution). There is also a different viewer named xview. | |
163 | .PP | |
164 | Note that if you have \fIlynx.exe\fR or \fInetscape.exe\fR installed, you can follow \s-1WWW\s0 links | |
165 | from this document in \fI.INF\fR format. If you have \s-1EMX\s0 docs installed | |
166 | correctly, you can follow library links (you need to have \f(CW\*(C`view emxbook\*(C'\fR | |
167 | working by setting \f(CW\*(C`EMXBOOK\*(C'\fR environment variable as it is described | |
168 | in \s-1EMX\s0 docs). | |
169 | .SH "DESCRIPTION" | |
170 | .IX Header "DESCRIPTION" | |
171 | .Sh "Target" | |
172 | .IX Subsection "Target" | |
173 | The target is to make \s-1OS/2\s0 one of the best supported platform for | |
174 | using/building/developing Perl and \fIPerl applications\fR, as well as | |
175 | make Perl the best language to use under \s-1OS/2\s0. The secondary target is | |
176 | to try to make this work under \s-1DOS\s0 and Win* as well (but not \fBtoo\fR hard). | |
177 | .PP | |
178 | The current state is quite close to this target. Known limitations: | |
179 | .IP "\(bu" 5 | |
180 | Some *nix programs use \fIfork()\fR a lot; with the mostly useful flavors of | |
181 | perl for \s-1OS/2\s0 (there are several built simultaneously) this is | |
182 | supported; but some flavors do not support this (e.g., when Perl is | |
183 | called from inside \s-1REXX\s0). Using \fIfork()\fR after | |
184 | \&\fIuse\fRing dynamically loading extensions would not work with \fIvery\fR old | |
185 | versions of \s-1EMX\s0. | |
186 | .IP "\(bu" 5 | |
187 | You need a separate perl executable \fIperl_\|_.exe\fR (see perl_\|_.exe) | |
188 | if you want to use \s-1PM\s0 code in your application (as Perl/Tk or OpenGL | |
189 | Perl modules do) without having a text-mode window present. | |
190 | .Sp | |
191 | While using the standard \fIperl.exe\fR from a text-mode window is possible | |
192 | too, I have seen cases when this causes degradation of the system stability. | |
193 | Using \fIperl_\|_.exe\fR avoids such a degradation. | |
194 | .IP "\(bu" 5 | |
195 | There is no simple way to access \s-1WPS\s0 objects. The only way I know | |
196 | is via \f(CW\*(C`OS2::REXX\*(C'\fR and \f(CW\*(C`SOM\*(C'\fR extensions (see \s-1OS2::REXX\s0, Som). | |
197 | However, we do not have access to | |
198 | convenience methods of Object\-REXX. (Is it possible at all? I know | |
199 | of no Object-REXX \s-1API\s0.) The \f(CW\*(C`SOM\*(C'\fR extension (currently in alpha\-text) | |
200 | may eventually remove this shortcoming; however, due to the fact that | |
201 | \&\s-1DII\s0 is not supported by the \f(CW\*(C`SOM\*(C'\fR module, using \f(CW\*(C`SOM\*(C'\fR is not as | |
202 | convenient as one would like it. | |
203 | .PP | |
204 | Please keep this list up-to-date by informing me about other items. | |
205 | .Sh "Other OSes" | |
206 | .IX Subsection "Other OSes" | |
207 | Since \s-1OS/2\s0 port of perl uses a remarkable \s-1EMX\s0 environment, it can | |
208 | run (and build extensions, and \- possibly \- be built itself) under any | |
209 | environment which can run \s-1EMX\s0. The current list is \s-1DOS\s0, | |
210 | DOS\-inside\-OS/2, Win0.3*, Win0.95 and WinNT. Out of many perl flavors, | |
211 | only one works, see \*(L"perl_.exe\*(R". | |
212 | .PP | |
213 | Note that not all features of Perl are available under these | |
214 | environments. This depends on the features the \fIextender\fR \- most | |
215 | probably \s-1RSX\s0 \- decided to implement. | |
216 | .PP | |
217 | Cf. Prerequisites. | |
218 | .Sh "Prerequisites" | |
219 | .IX Subsection "Prerequisites" | |
220 | .IP "\s-1EMX\s0" 6 | |
221 | .IX Item "EMX" | |
222 | \&\s-1EMX\s0 runtime is required (may be substituted by \s-1RSX\s0). Note that | |
223 | it is possible to make \fIperl_.exe\fR to run under \s-1DOS\s0 without any | |
224 | external support by binding \fIemx.exe\fR/\fIrsx.exe\fR to it, see emxbind. Note | |
225 | that under \s-1DOS\s0 for best results one should use \s-1RSX\s0 runtime, which | |
226 | has much more functions working (like \f(CW\*(C`fork\*(C'\fR, \f(CW\*(C`popen\*(C'\fR and so on). In | |
227 | fact \s-1RSX\s0 is required if there is no \s-1VCPI\s0 present. Note the | |
228 | \&\s-1RSX\s0 requires \s-1DPMI\s0. Many implementations of \s-1DPMI\s0 are known to be very | |
229 | buggy, beware! | |
230 | .Sp | |
231 | Only the latest runtime is supported, currently \f(CW\*(C`0.9d fix 03\*(C'\fR. Perl may run | |
232 | under earlier versions of \s-1EMX\s0, but this is not tested. | |
233 | .Sp | |
234 | One can get different parts of \s-1EMX\s0 from, say | |
235 | .Sp | |
236 | .Vb 3 | |
237 | \& http://www.leo.org/pub/comp/os/os2/leo/gnu/emx+gcc/ | |
238 | \& http://powerusersbbs.com/pub/os2/dev/ [EMX+GCC Development] | |
239 | \& http://hobbes.nmsu.edu/pub/os2/dev/emx/v0.9d/ | |
240 | .Ve | |
241 | .Sp | |
242 | The runtime component should have the name \fIemxrt.zip\fR. | |
243 | .Sp | |
244 | \&\fB\s-1NOTE\s0\fR. When using \fIemx.exe\fR/\fIrsx.exe\fR, it is enough to have them on your path. One | |
245 | does not need to specify them explicitly (though this | |
246 | .Sp | |
247 | .Vb 1 | |
248 | \& emx perl_.exe -de 0 | |
249 | .Ve | |
250 | .Sp | |
251 | will work as well.) | |
252 | .IP "\s-1RSX\s0" 6 | |
253 | .IX Item "RSX" | |
254 | To run Perl on \s-1DPMI\s0 platforms one needs \s-1RSX\s0 runtime. This is | |
255 | needed under DOS\-inside\-OS/2, Win0.3*, Win0.95 and WinNT (see | |
256 | \&\*(L"Other OSes\*(R"). \s-1RSX\s0 would not work with \s-1VCPI\s0 | |
257 | only, as \s-1EMX\s0 would, it requires \s-1DMPI\s0. | |
258 | .Sp | |
259 | Having \s-1RSX\s0 and the latest \fIsh.exe\fR one gets a fully functional | |
260 | \&\fB*nix\fR\-ish environment under \s-1DOS\s0, say, \f(CW\*(C`fork\*(C'\fR, \f(CW``\fR and | |
261 | pipe\-\f(CW\*(C`open\*(C'\fR work. In fact, MakeMaker works (for static build), so one | |
262 | can have Perl development environment under \s-1DOS\s0. | |
263 | .Sp | |
264 | One can get \s-1RSX\s0 from, say | |
265 | .Sp | |
266 | .Vb 3 | |
267 | \& ftp://ftp.cdrom.com/pub/os2/emx09c/contrib | |
268 | \& ftp://ftp.uni-bielefeld.de/pub/systems/msdos/misc | |
269 | \& ftp://ftp.leo.org/pub/comp/os/os2/leo/devtools/emx+gcc/contrib | |
270 | .Ve | |
271 | .Sp | |
272 | Contact the author on \f(CW\*(C`rainer@mathematik.uni\-bielefeld.de\*(C'\fR. | |
273 | .Sp | |
274 | The latest \fIsh.exe\fR with \s-1DOS\s0 hooks is available in | |
275 | .Sp | |
276 | .Vb 1 | |
277 | \& http://www.ilyaz.org/software/os2/ | |
278 | .Ve | |
279 | .Sp | |
280 | as \fIsh_dos.zip\fR or under similar names starting with \f(CW\*(C`sh\*(C'\fR, \f(CW\*(C`pdksh\*(C'\fR etc. | |
281 | .IP "\s-1HPFS\s0" 6 | |
282 | .IX Item "HPFS" | |
283 | Perl does not care about file systems, but the perl library contains | |
284 | many files with long names, so to install it intact one needs a file | |
285 | system which supports long file names. | |
286 | .Sp | |
287 | Note that if you do not plan to build the perl itself, it may be | |
288 | possible to fool \s-1EMX\s0 to truncate file names. This is not supported, | |
289 | read \s-1EMX\s0 docs to see how to do it. | |
290 | .IP "pdksh" 6 | |
291 | .IX Item "pdksh" | |
292 | To start external programs with complicated command lines (like with | |
293 | pipes in between, and/or quoting of arguments), Perl uses an external | |
294 | shell. With \s-1EMX\s0 port such shell should be named \fIsh.exe\fR, and located | |
295 | either in the wired-in-during-compile locations (usually \fIF:/bin\fR), | |
296 | or in configurable location (see \*(L"\s-1PERL_SH_DIR\s0\*(R"). | |
297 | .Sp | |
298 | For best results use \s-1EMX\s0 pdksh. The standard binary (5.2.14 or later) runs | |
299 | under \s-1DOS\s0 (with \s-1RSX\s0) as well, see | |
300 | .Sp | |
301 | .Vb 1 | |
302 | \& http://www.ilyaz.org/software/os2/ | |
303 | .Ve | |
304 | .Sh "Starting Perl programs under \s-1OS/2\s0 (and \s-1DOS\s0 and...)" | |
305 | .IX Subsection "Starting Perl programs under OS/2 (and DOS and...)" | |
306 | Start your Perl program \fIfoo.pl\fR with arguments \f(CW\*(C`arg1 arg2 arg3\*(C'\fR the | |
307 | same way as on any other platform, by | |
308 | .PP | |
309 | .Vb 1 | |
310 | \& perl foo.pl arg1 arg2 arg3 | |
311 | .Ve | |
312 | .PP | |
313 | If you want to specify perl options \f(CW\*(C`\-my_opts\*(C'\fR to the perl itself (as | |
314 | opposed to your program), use | |
315 | .PP | |
316 | .Vb 1 | |
317 | \& perl -my_opts foo.pl arg1 arg2 arg3 | |
318 | .Ve | |
319 | .PP | |
320 | Alternately, if you use OS/2\-ish shell, like \s-1CMD\s0 or 4os2, put | |
321 | the following at the start of your perl script: | |
322 | .PP | |
323 | .Vb 1 | |
324 | \& extproc perl -S -my_opts | |
325 | .Ve | |
326 | .PP | |
327 | rename your program to \fIfoo.cmd\fR, and start it by typing | |
328 | .PP | |
329 | .Vb 1 | |
330 | \& foo arg1 arg2 arg3 | |
331 | .Ve | |
332 | .PP | |
333 | Note that because of stupid \s-1OS/2\s0 limitations the full path of the perl | |
334 | script is not available when you use \f(CW\*(C`extproc\*(C'\fR, thus you are forced to | |
335 | use \f(CW\*(C`\-S\*(C'\fR perl switch, and your script should be on the \f(CW\*(C`PATH\*(C'\fR. As a plus | |
336 | side, if you know a full path to your script, you may still start it | |
337 | with | |
338 | .PP | |
339 | .Vb 1 | |
340 | \& perl ../../blah/foo.cmd arg1 arg2 arg3 | |
341 | .Ve | |
342 | .PP | |
343 | (note that the argument \f(CW\*(C`\-my_opts\*(C'\fR is taken care of by the \f(CW\*(C`extproc\*(C'\fR line | |
344 | in your script, see "\f(CW\*(C`extproc\*(C'\fR on the first line"). | |
345 | .PP | |
346 | To understand what the above \fImagic\fR does, read perl docs about \f(CW\*(C`\-S\*(C'\fR | |
347 | switch \- see perlrun, and cmdref about \f(CW\*(C`extproc\*(C'\fR: | |
348 | .PP | |
349 | .Vb 4 | |
350 | \& view perl perlrun | |
351 | \& man perlrun | |
352 | \& view cmdref extproc | |
353 | \& help extproc | |
354 | .Ve | |
355 | .PP | |
356 | or whatever method you prefer. | |
357 | .PP | |
358 | There are also endless possibilities to use \fIexecutable extensions\fR of | |
359 | 4os2, \fIassociations\fR of \s-1WPS\s0 and so on... However, if you use | |
360 | *nixish shell (like \fIsh.exe\fR supplied in the binary distribution), | |
361 | you need to follow the syntax specified in \*(L"Switches\*(R" in perlrun. | |
362 | .PP | |
363 | Note that \fB\-S\fR switch supports scripts with additional extensions | |
364 | \&\fI.cmd\fR, \fI.btm\fR, \fI.bat\fR, \fI.pl\fR as well. | |
365 | .Sh "Starting \s-1OS/2\s0 (and \s-1DOS\s0) programs under Perl" | |
366 | .IX Subsection "Starting OS/2 (and DOS) programs under Perl" | |
367 | This is what \fIsystem()\fR (see \*(L"system\*(R" in perlfunc), \f(CW``\fR (see | |
368 | \&\*(L"I/O Operators\*(R" in perlop), and \fIopen pipe\fR (see \*(L"open\*(R" in perlfunc) | |
369 | are for. (Avoid \fIexec()\fR (see \*(L"exec\*(R" in perlfunc) unless you know what you | |
370 | do). | |
371 | .PP | |
372 | Note however that to use some of these operators you need to have a | |
373 | sh-syntax shell installed (see \*(L"Pdksh\*(R", | |
374 | \&\*(L"Frequently asked questions\*(R"), and perl should be able to find it | |
375 | (see \*(L"\s-1PERL_SH_DIR\s0\*(R"). | |
376 | .PP | |
377 | The cases when the shell is used are: | |
378 | .IP "1" 4 | |
379 | .IX Item "1" | |
380 | One-argument \fIsystem()\fR (see \*(L"system\*(R" in perlfunc), \fIexec()\fR (see \*(L"exec\*(R" in perlfunc) | |
381 | with redirection or shell meta\-characters; | |
382 | .IP "2" 4 | |
383 | .IX Item "2" | |
384 | Pipe-open (see \*(L"open\*(R" in perlfunc) with the command which contains redirection | |
385 | or shell meta\-characters; | |
386 | .IP "3" 4 | |
387 | .IX Item "3" | |
388 | Backticks \f(CW``\fR (see \*(L"I/O Operators\*(R" in perlop) with the command which contains | |
389 | redirection or shell meta\-characters; | |
390 | .IP "4" 4 | |
391 | .IX Item "4" | |
392 | If the executable called by \fIsystem()\fR/\fIexec()\fR/pipe\-\fIopen()\fR/\f(CW``\fR is a script | |
393 | with the \*(L"magic\*(R" \f(CW\*(C`#!\*(C'\fR line or \f(CW\*(C`extproc\*(C'\fR line which specifies shell; | |
394 | .IP "5" 4 | |
395 | .IX Item "5" | |
396 | If the executable called by \fIsystem()\fR/\fIexec()\fR/pipe\-\fIopen()\fR/\f(CW``\fR is a script | |
397 | without \*(L"magic\*(R" line, and \f(CW$ENV{EXECSHELL}\fR is set to shell; | |
398 | .IP "6" 4 | |
399 | .IX Item "6" | |
400 | If the executable called by \fIsystem()\fR/\fIexec()\fR/pipe\-\fIopen()\fR/\f(CW``\fR is not | |
401 | found (is not this remark obsolete?); | |
402 | .IP "7" 4 | |
403 | .IX Item "7" | |
404 | For globbing (see \*(L"glob\*(R" in perlfunc, \*(L"I/O Operators\*(R" in perlop) | |
405 | (obsolete? Perl uses builtin globbing nowadays...). | |
406 | .PP | |
407 | For the sake of speed for a common case, in the above algorithms | |
408 | backslashes in the command name are not considered as shell metacharacters. | |
409 | .PP | |
410 | Perl starts scripts which begin with cookies | |
411 | \&\f(CW\*(C`extproc\*(C'\fR or \f(CW\*(C`#!\*(C'\fR directly, without an intervention of shell. Perl uses the | |
412 | same algorithm to find the executable as \fIpdksh\fR: if the path | |
413 | on \f(CW\*(C`#!\*(C'\fR line does not work, and contains \f(CW\*(C`/\*(C'\fR, then the directory | |
414 | part of the executable is ignored, and the executable | |
415 | is searched in \fI.\fR and on \f(CW\*(C`PATH\*(C'\fR. To find arguments for these scripts | |
416 | Perl uses a different algorithm than \fIpdksh\fR: up to 3 arguments are | |
417 | recognized, and trailing whitespace is stripped. | |
418 | .PP | |
419 | If a script | |
420 | does not contain such a cooky, then to avoid calling \fIsh.exe\fR, Perl uses | |
421 | the same algorithm as \fIpdksh\fR: if \f(CW$ENV{EXECSHELL}\fR is set, the | |
422 | script is given as the first argument to this command, if not set, then | |
423 | \&\f(CW\*(C`$ENV{COMSPEC} /c\*(C'\fR is used (or a hardwired guess if \f(CW$ENV{COMSPEC}\fR is | |
424 | not set). | |
425 | .PP | |
426 | When starting scripts directly, Perl uses exactly the same algorithm as for | |
427 | the search of script given by \fB\-S\fR command-line option: it will look in | |
428 | the current directory, then on components of \f(CW$ENV{PATH}\fR using the | |
429 | following order of appended extensions: no extension, \fI.cmd\fR, \fI.btm\fR, | |
430 | \&\fI.bat\fR, \fI.pl\fR. | |
431 | .PP | |
432 | Note that Perl will start to look for scripts only if \s-1OS/2\s0 cannot start the | |
433 | specified application, thus \f(CW\*(C`system 'blah'\*(C'\fR will not look for a script if | |
434 | there is an executable file \fIblah.exe\fR \fIanywhere\fR on \f(CW\*(C`PATH\*(C'\fR. In | |
435 | other words, \f(CW\*(C`PATH\*(C'\fR is essentially searched twice: once by the \s-1OS\s0 for | |
436 | an executable, then by Perl for scripts. | |
437 | .PP | |
438 | Note also that executable files on \s-1OS/2\s0 can have an arbitrary extension, | |
439 | but \fI.exe\fR will be automatically appended if no dot is present in the name. | |
440 | The workaround is as simple as that: since \fIblah.\fR and \fIblah\fR denote the | |
441 | same file (at list on \s-1FAT\s0 and \s-1HPFS\s0 file systems), to start an executable residing in file \fIn:/bin/blah\fR (no | |
442 | extension) give an argument \f(CW\*(C`n:/bin/blah.\*(C'\fR (dot appended) to \fIsystem()\fR. | |
443 | .PP | |
444 | Perl will start \s-1PM\s0 programs from \s-1VIO\s0 (=text\-mode) Perl process in a | |
445 | separate \s-1PM\s0 session; | |
446 | the opposite is not true: when you start a non-PM program from a \s-1PM\s0 | |
447 | Perl process, Perl would not run it in a separate session. If a separate | |
448 | session is desired, either ensure | |
449 | that shell will be used, as in \f(CW\*(C`system 'cmd /c myprog'\*(C'\fR, or start it using | |
450 | optional arguments to \fIsystem()\fR documented in \f(CW\*(C`OS2::Process\*(C'\fR module. This | |
451 | is considered to be a feature. | |
452 | .SH "Frequently asked questions" | |
453 | .IX Header "Frequently asked questions" | |
454 | .ie n .Sh """It does not work""" | |
455 | .el .Sh "``It does not work''" | |
456 | .IX Subsection "It does not work" | |
457 | Perl binary distributions come with a \fItestperl.cmd\fR script which tries | |
458 | to detect common problems with misconfigured installations. There is a | |
459 | pretty large chance it will discover which step of the installation you | |
460 | managed to goof. \f(CW\*(C`;\-)\*(C'\fR | |
461 | .Sh "I cannot run external programs" | |
462 | .IX Subsection "I cannot run external programs" | |
463 | .IP "\(bu" 4 | |
464 | Did you run your programs with \f(CW\*(C`\-w\*(C'\fR switch? See | |
465 | \&\*(L"2 (and \s-1DOS\s0) programs under Perl\*(R" in Starting \s-1OS\s0. | |
466 | .IP "\(bu" 4 | |
467 | Do you try to run \fIinternal\fR shell commands, like \f(CW`copy a b`\fR | |
468 | (internal for \fIcmd.exe\fR), or \f(CW`glob a*b`\fR (internal for ksh)? You | |
469 | need to specify your shell explicitly, like \f(CW`cmd /c copy a b`\fR, | |
470 | since Perl cannot deduce which commands are internal to your shell. | |
471 | .Sh "I cannot embed perl into my program, or use \fIperl.dll\fP from my program." | |
472 | .IX Subsection "I cannot embed perl into my program, or use perl.dll from my program." | |
473 | .ie n .IP "Is your program EMX-compiled with ""\-Zmt \-Zcrtdll""?" 4 | |
474 | .el .IP "Is your program EMX-compiled with \f(CW\-Zmt \-Zcrtdll\fR?" 4 | |
475 | .IX Item "Is your program EMX-compiled with -Zmt -Zcrtdll?" | |
476 | Well, nowadays Perl \s-1DLL\s0 should be usable from a differently compiled | |
477 | program too... If you can run Perl code from \s-1REXX\s0 scripts (see | |
478 | \&\s-1OS2::REXX\s0), then there are some other aspect of interaction which | |
479 | are overlooked by the current hackish code to support | |
480 | differently-compiled principal programs. | |
481 | .Sp | |
482 | If everything else fails, you need to build a stand-alone \s-1DLL\s0 for | |
483 | perl. Contact me, I did it once. Sockets would not work, as a lot of | |
484 | other stuff. | |
485 | .IP "Did you use ExtUtils::Embed?" 4 | |
486 | .IX Item "Did you use ExtUtils::Embed?" | |
487 | Some time ago I had reports it does not work. Nowadays it is checked | |
488 | in the Perl test suite, so grep \fI./t\fR subdirectory of the build tree | |
489 | (as well as \fI*.t\fR files in the \fI./lib\fR subdirectory) to find how it | |
490 | should be done \*(L"correctly\*(R". | |
491 | .ie n .Sh "``\fP and pipe\-\f(CW""open"" do not work under \s-1DOS\s0." | |
492 | .el .Sh "\f(CW``\fP and pipe\-\f(CWopen\fP do not work under \s-1DOS\s0." | |
493 | .IX Subsection "`` and pipe-open do not work under DOS." | |
494 | This may a variant of just \*(L"I cannot run external programs\*(R", or a | |
495 | deeper problem. Basically: you \fIneed\fR \s-1RSX\s0 (see \*(L"Prerequisites\*(R") | |
496 | for these commands to work, and you may need a port of \fIsh.exe\fR which | |
497 | understands command arguments. One of such ports is listed in | |
498 | \&\*(L"Prerequisites\*(R" under \s-1RSX\s0. Do not forget to set variable | |
499 | \&\f(CW\*(C`\*(L"\s-1PERL_SH_DIR\s0\*(R"\*(C'\fR as well. | |
500 | .PP | |
501 | \&\s-1DPMI\s0 is required for \s-1RSX\s0. | |
502 | .ie n .Sh "Cannot start ""find.exe ""pattern"" file""" | |
503 | .el .Sh "Cannot start \f(CWfind.exe ``pattern'' file\fP" | |
504 | .IX Subsection "Cannot start find.exe ""pattern"" file" | |
505 | The whole idea of the \*(L"standard C \s-1API\s0 to start applications\*(R" is that | |
506 | the forms \f(CW\*(C`foo\*(C'\fR and \f(CW"foo"\fR of program arguments are completely | |
507 | interchangable. \fIfind\fR breaks this paradigm; | |
508 | .PP | |
509 | .Vb 2 | |
510 | \& find "pattern" file | |
511 | \& find pattern file | |
512 | .Ve | |
513 | .PP | |
514 | are not equivalent; \fIfind\fR cannot be started directly using the above | |
515 | \&\s-1API\s0. One needs a way to surround the doublequotes in some other | |
516 | quoting construction, necessarily having an extra non-Unixish shell in | |
517 | between. | |
518 | .PP | |
519 | Use one of | |
520 | .PP | |
521 | .Vb 2 | |
522 | \& system 'cmd', '/c', 'find "pattern" file'; | |
523 | \& `cmd /c 'find "pattern" file'` | |
524 | .Ve | |
525 | .PP | |
526 | This would start \fIfind.exe\fR via \fIcmd.exe\fR via \f(CW\*(C`sh.exe\*(C'\fR via | |
527 | \&\f(CW\*(C`perl.exe\*(C'\fR, but this is a price to pay if you want to use | |
528 | non-conforming program. | |
529 | .SH "INSTALLATION" | |
530 | .IX Header "INSTALLATION" | |
531 | .Sh "Automatic binary installation" | |
532 | .IX Subsection "Automatic binary installation" | |
533 | The most convenient way of installing a binary distribution of perl is via perl installer | |
534 | \&\fIinstall.exe\fR. Just follow the instructions, and 99% of the | |
535 | installation blues would go away. | |
536 | .PP | |
537 | Note however, that you need to have \fIunzip.exe\fR on your path, and | |
538 | \&\s-1EMX\s0 environment \fIrunning\fR. The latter means that if you just | |
539 | installed \s-1EMX\s0, and made all the needed changes to \fIConfig.sys\fR, | |
540 | you may need to reboot in between. Check \s-1EMX\s0 runtime by running | |
541 | .PP | |
542 | .Vb 1 | |
543 | \& emxrev | |
544 | .Ve | |
545 | .PP | |
546 | Binary installer also creates a folder on your desktop with some useful | |
547 | objects. If you need to change some aspects of the work of the binary | |
548 | installer, feel free to edit the file \fIPerl.pkg\fR. This may be useful | |
549 | e.g., if you need to run the installer many times and do not want to | |
550 | make many interactive changes in the \s-1GUI\s0. | |
551 | .PP | |
552 | \&\fBThings not taken care of by automatic binary installation:\fR | |
553 | .ie n .IP """PERL_BADLANG""" 15 | |
554 | .el .IP "\f(CWPERL_BADLANG\fR" 15 | |
555 | .IX Item "PERL_BADLANG" | |
556 | may be needed if you change your codepage \fIafter\fR perl installation, | |
557 | and the new value is not supported by \s-1EMX\s0. See \*(L"\s-1PERL_BADLANG\s0\*(R". | |
558 | .ie n .IP """PERL_BADFREE""" 15 | |
559 | .el .IP "\f(CWPERL_BADFREE\fR" 15 | |
560 | .IX Item "PERL_BADFREE" | |
561 | see \*(L"\s-1PERL_BADFREE\s0\*(R". | |
562 | .IP "\fIConfig.pm\fR" 15 | |
563 | .IX Item "Config.pm" | |
564 | This file resides somewhere deep in the location you installed your | |
565 | perl library, find it out by | |
566 | .Sp | |
567 | .Vb 1 | |
568 | \& perl -MConfig -le "print $INC{'Config.pm'}" | |
569 | .Ve | |
570 | .Sp | |
571 | While most important values in this file \fIare\fR updated by the binary | |
572 | installer, some of them may need to be hand\-edited. I know no such | |
573 | data, please keep me informed if you find one. Moreover, manual | |
574 | changes to the installed version may need to be accompanied by an edit | |
575 | of this file. | |
576 | .PP | |
577 | \&\fB\s-1NOTE\s0\fR. Because of a typo the binary installer of 5.00305 | |
578 | would install a variable \f(CW\*(C`PERL_SHPATH\*(C'\fR into \fIConfig.sys\fR. Please | |
579 | remove this variable and put \f(CW\*(C`\s-1PERL_SH_DIR\s0\*(C'\fR instead. | |
580 | .Sh "Manual binary installation" | |
581 | .IX Subsection "Manual binary installation" | |
582 | As of version 5.00305, \s-1OS/2\s0 perl binary distribution comes split | |
583 | into 11 components. Unfortunately, to enable configurable binary | |
584 | installation, the file paths in the zip files are not absolute, but | |
585 | relative to some directory. | |
586 | .PP | |
587 | Note that the extraction with the stored paths is still necessary | |
588 | (default with unzip, specify \f(CW\*(C`\-d\*(C'\fR to pkunzip). However, you | |
589 | need to know where to extract the files. You need also to manually | |
590 | change entries in \fIConfig.sys\fR to reflect where did you put the | |
591 | files. Note that if you have some primitive unzipper (like | |
592 | \&\f(CW\*(C`pkunzip\*(C'\fR), you may get a lot of warnings/errors during | |
593 | unzipping. Upgrade to \f(CW\*(C`(w)unzip\*(C'\fR. | |
594 | .PP | |
595 | Below is the sample of what to do to reproduce the configuration on my | |
596 | machine. In \fI\s-1VIEW\s0.EXE\fR you can press \f(CW\*(C`Ctrl\-Insert\*(C'\fR now, and | |
597 | cut-and-paste from the resulting file \- created in the directory you | |
598 | started \fI\s-1VIEW\s0.EXE\fR from. | |
599 | .PP | |
600 | For each component, we mention environment variables related to each | |
601 | installation directory. Either choose directories to match your | |
602 | values of the variables, or create/append\-to variables to take into | |
603 | account the directories. | |
604 | .IP "Perl \s-1VIO\s0 and \s-1PM\s0 executables (dynamically linked)" 3 | |
605 | .IX Item "Perl VIO and PM executables (dynamically linked)" | |
606 | .Vb 2 | |
607 | \& unzip perl_exc.zip *.exe *.ico -d f:/emx.add/bin | |
608 | \& unzip perl_exc.zip *.dll -d f:/emx.add/dll | |
609 | .Ve | |
610 | .Sp | |
611 | (have the directories with \f(CW\*(C`*.exe\*(C'\fR on \s-1PATH\s0, and \f(CW\*(C`*.dll\*(C'\fR on | |
612 | \&\s-1LIBPATH\s0); | |
613 | .IP "Perl_ \s-1VIO\s0 executable (statically linked)" 3 | |
614 | .IX Item "Perl_ VIO executable (statically linked)" | |
615 | .Vb 1 | |
616 | \& unzip perl_aou.zip -d f:/emx.add/bin | |
617 | .Ve | |
618 | .Sp | |
619 | (have the directory on \s-1PATH\s0); | |
620 | .IP "Executables for Perl utilities" 3 | |
621 | .IX Item "Executables for Perl utilities" | |
622 | .Vb 1 | |
623 | \& unzip perl_utl.zip -d f:/emx.add/bin | |
624 | .Ve | |
625 | .Sp | |
626 | (have the directory on \s-1PATH\s0); | |
627 | .IP "Main Perl library" 3 | |
628 | .IX Item "Main Perl library" | |
629 | .Vb 1 | |
630 | \& unzip perl_mlb.zip -d f:/perllib/lib | |
631 | .Ve | |
632 | .Sp | |
633 | If this directory is exactly the same as the prefix which was compiled | |
634 | into \fIperl.exe\fR, you do not need to change | |
635 | anything. However, for perl to find the library if you use a different | |
636 | path, you need to | |
637 | \&\f(CW\*(C`set PERLLIB_PREFIX\*(C'\fR in \fIConfig.sys\fR, see \*(L"\s-1PERLLIB_PREFIX\s0\*(R". | |
638 | .IP "Additional Perl modules" 3 | |
639 | .IX Item "Additional Perl modules" | |
640 | .Vb 1 | |
641 | \& unzip perl_ste.zip -d f:/perllib/lib/site_perl/5.8.8/ | |
642 | .Ve | |
643 | .Sp | |
644 | Same remark as above applies. Additionally, if this directory is not | |
645 | one of directories on \f(CW@INC\fR (and \f(CW@INC\fR is influenced by \f(CW\*(C`PERLLIB_PREFIX\*(C'\fR), you | |
646 | need to put this | |
647 | directory and subdirectory \fI./os2\fR in \f(CW\*(C`PERLLIB\*(C'\fR or \f(CW\*(C`PERL5LIB\*(C'\fR | |
648 | variable. Do not use \f(CW\*(C`PERL5LIB\*(C'\fR unless you have it set already. See | |
649 | \&\*(L"\s-1ENVIRONMENT\s0\*(R" in perl. | |
650 | .Sp | |
651 | \&\fB[Check whether this extraction directory is still applicable with | |
652 | the new directory structure layout!]\fR | |
653 | .IP "Tools to compile Perl modules" 3 | |
654 | .IX Item "Tools to compile Perl modules" | |
655 | .Vb 1 | |
656 | \& unzip perl_blb.zip -d f:/perllib/lib | |
657 | .Ve | |
658 | .Sp | |
659 | Same remark as for \fIperl_ste.zip\fR. | |
660 | .IP "Manpages for Perl and utilities" 3 | |
661 | .IX Item "Manpages for Perl and utilities" | |
662 | .Vb 1 | |
663 | \& unzip perl_man.zip -d f:/perllib/man | |
664 | .Ve | |
665 | .Sp | |
666 | This directory should better be on \f(CW\*(C`MANPATH\*(C'\fR. You need to have a | |
667 | working \fIman\fR to access these files. | |
668 | .IP "Manpages for Perl modules" 3 | |
669 | .IX Item "Manpages for Perl modules" | |
670 | .Vb 1 | |
671 | \& unzip perl_mam.zip -d f:/perllib/man | |
672 | .Ve | |
673 | .Sp | |
674 | This directory should better be on \f(CW\*(C`MANPATH\*(C'\fR. You need to have a | |
675 | working man to access these files. | |
676 | .IP "Source for Perl documentation" 3 | |
677 | .IX Item "Source for Perl documentation" | |
678 | .Vb 1 | |
679 | \& unzip perl_pod.zip -d f:/perllib/lib | |
680 | .Ve | |
681 | .Sp | |
682 | This is used by the \f(CW\*(C`perldoc\*(C'\fR program (see perldoc), and may be used to | |
683 | generate \s-1HTML\s0 documentation usable by \s-1WWW\s0 browsers, and | |
684 | documentation in zillions of other formats: \f(CW\*(C`info\*(C'\fR, \f(CW\*(C`LaTeX\*(C'\fR, | |
685 | \&\f(CW\*(C`Acrobat\*(C'\fR, \f(CW\*(C`FrameMaker\*(C'\fR and so on. [Use programs such as | |
686 | \&\fIpod2latex\fR etc.] | |
687 | .IP "Perl manual in \fI.INF\fR format" 3 | |
688 | .IX Item "Perl manual in .INF format" | |
689 | .Vb 1 | |
690 | \& unzip perl_inf.zip -d d:/os2/book | |
691 | .Ve | |
692 | .Sp | |
693 | This directory should better be on \f(CW\*(C`BOOKSHELF\*(C'\fR. | |
694 | .IP "Pdksh" 3 | |
695 | .IX Item "Pdksh" | |
696 | .Vb 1 | |
697 | \& unzip perl_sh.zip -d f:/bin | |
698 | .Ve | |
699 | .Sp | |
700 | This is used by perl to run external commands which explicitly | |
701 | require shell, like the commands using \fIredirection\fR and \fIshell | |
702 | metacharacters\fR. It is also used instead of explicit \fI/bin/sh\fR. | |
703 | .Sp | |
704 | Set \f(CW\*(C`PERL_SH_DIR\*(C'\fR (see \*(L"\s-1PERL_SH_DIR\s0\*(R") if you move \fIsh.exe\fR from | |
705 | the above location. | |
706 | .Sp | |
707 | \&\fBNote.\fR It may be possible to use some other sh-compatible shell (untested). | |
708 | .PP | |
709 | After you installed the components you needed and updated the | |
710 | \&\fIConfig.sys\fR correspondingly, you need to hand-edit | |
711 | \&\fIConfig.pm\fR. This file resides somewhere deep in the location you | |
712 | installed your perl library, find it out by | |
713 | .PP | |
714 | .Vb 1 | |
715 | \& perl -MConfig -le "print $INC{'Config.pm'}" | |
716 | .Ve | |
717 | .PP | |
718 | You need to correct all the entries which look like file paths (they | |
719 | currently start with \f(CW\*(C`f:/\*(C'\fR). | |
720 | .Sh "\fBWarning\fP" | |
721 | .IX Subsection "Warning" | |
722 | The automatic and manual perl installation leave precompiled paths | |
723 | inside perl executables. While these paths are overwriteable (see | |
724 | \&\*(L"\s-1PERLLIB_PREFIX\s0\*(R", \*(L"\s-1PERL_SH_DIR\s0\*(R"), some people may prefer | |
725 | binary editing of paths inside the executables/DLLs. | |
726 | .SH "Accessing documentation" | |
727 | .IX Header "Accessing documentation" | |
728 | Depending on how you built/installed perl you may have (otherwise | |
729 | identical) Perl documentation in the following formats: | |
730 | .Sh "\s-1OS/2\s0 \fI.INF\fP file" | |
731 | .IX Subsection "OS/2 .INF file" | |
732 | Most probably the most convenient form. Under \s-1OS/2\s0 view it as | |
733 | .PP | |
734 | .Vb 4 | |
735 | \& view perl | |
736 | \& view perl perlfunc | |
737 | \& view perl less | |
738 | \& view perl ExtUtils::MakeMaker | |
739 | .Ve | |
740 | .PP | |
741 | (currently the last two may hit a wrong location, but this may improve | |
742 | soon). Under Win* see \*(L"\s-1SYNOPSIS\s0\*(R". | |
743 | .PP | |
744 | If you want to build the docs yourself, and have \fI\s-1OS/2\s0 toolkit\fR, run | |
745 | .PP | |
746 | .Vb 1 | |
747 | \& pod2ipf > perl.ipf | |
748 | .Ve | |
749 | .PP | |
750 | in \fI/perllib/lib/pod\fR directory, then | |
751 | .PP | |
752 | .Vb 1 | |
753 | \& ipfc /inf perl.ipf | |
754 | .Ve | |
755 | .PP | |
756 | (Expect a lot of errors during the both steps.) Now move it on your | |
757 | \&\s-1BOOKSHELF\s0 path. | |
758 | .Sh "Plain text" | |
759 | .IX Subsection "Plain text" | |
760 | If you have perl documentation in the source form, perl utilities | |
761 | installed, and \s-1GNU\s0 groff installed, you may use | |
762 | .PP | |
763 | .Vb 3 | |
764 | \& perldoc perlfunc | |
765 | \& perldoc less | |
766 | \& perldoc ExtUtils::MakeMaker | |
767 | .Ve | |
768 | .PP | |
769 | to access the perl documentation in the text form (note that you may get | |
770 | better results using perl manpages). | |
771 | .PP | |
772 | Alternately, try running pod2text on \fI.pod\fR files. | |
773 | .Sh "Manpages" | |
774 | .IX Subsection "Manpages" | |
775 | If you have \fIman\fR installed on your system, and you installed perl | |
776 | manpages, use something like this: | |
777 | .PP | |
778 | .Vb 3 | |
779 | \& man perlfunc | |
780 | \& man 3 less | |
781 | \& man ExtUtils.MakeMaker | |
782 | .Ve | |
783 | .PP | |
784 | to access documentation for different components of Perl. Start with | |
785 | .PP | |
786 | .Vb 1 | |
787 | \& man perl | |
788 | .Ve | |
789 | .PP | |
790 | Note that dot (\fI.\fR) is used as a package separator for documentation | |
791 | for packages, and as usual, sometimes you need to give the section \- \f(CW3\fR | |
792 | above \- to avoid shadowing by the \fI\fIless\fI\|(1) manpage\fR. | |
793 | .PP | |
794 | Make sure that the directory \fBabove\fR the directory with manpages is | |
795 | on our \f(CW\*(C`MANPATH\*(C'\fR, like this | |
796 | .PP | |
797 | .Vb 1 | |
798 | \& set MANPATH=c:/man;f:/perllib/man | |
799 | .Ve | |
800 | .PP | |
801 | for Perl manpages in \f(CW\*(C`f:/perllib/man/man1/\*(C'\fR etc. | |
802 | .Sh "\s-1HTML\s0" | |
803 | .IX Subsection "HTML" | |
804 | If you have some \s-1WWW\s0 browser available, installed the Perl | |
805 | documentation in the source form, and Perl utilities, you can build | |
806 | \&\s-1HTML\s0 docs. Cd to directory with \fI.pod\fR files, and do like this | |
807 | .PP | |
808 | .Vb 2 | |
809 | \& cd f:/perllib/lib/pod | |
810 | \& pod2html | |
811 | .Ve | |
812 | .PP | |
813 | After this you can direct your browser the file \fIperl.html\fR in this | |
814 | directory, and go ahead with reading docs, like this: | |
815 | .PP | |
816 | .Vb 1 | |
817 | \& explore file:///f:/perllib/lib/pod/perl.html | |
818 | .Ve | |
819 | .PP | |
820 | Alternatively you may be able to get these docs prebuilt from \s-1CPAN\s0. | |
821 | .ie n .Sh "\s-1GNU\s0 ""info"" files" | |
822 | .el .Sh "\s-1GNU\s0 \f(CWinfo\fP files" | |
823 | .IX Subsection "GNU info files" | |
824 | Users of Emacs would appreciate it very much, especially with | |
825 | \&\f(CW\*(C`CPerl\*(C'\fR mode loaded. You need to get latest \f(CW\*(C`pod2texi\*(C'\fR from \f(CW\*(C`CPAN\*(C'\fR, | |
826 | or, alternately, the prebuilt info pages. | |
827 | .Sh "\fI\s-1PDF\s0\fP files" | |
828 | .IX Subsection "PDF files" | |
829 | for \f(CW\*(C`Acrobat\*(C'\fR are available on \s-1CPAN\s0 (may be for slightly older version of | |
830 | perl). | |
831 | .ie n .Sh """LaTeX"" docs" | |
832 | .el .Sh "\f(CWLaTeX\fP docs" | |
833 | .IX Subsection "LaTeX docs" | |
834 | can be constructed using \f(CW\*(C`pod2latex\*(C'\fR. | |
835 | .SH "BUILD" | |
836 | .IX Header "BUILD" | |
837 | Here we discuss how to build Perl under \s-1OS/2\s0. There is an alternative | |
838 | (but maybe older) view on <http://www.shadow.net/~troc/os2perl.html>. | |
839 | .Sh "The short story" | |
840 | .IX Subsection "The short story" | |
841 | Assume that you are a seasoned porter, so are sure that all the necessary | |
842 | tools are already present on your system, and you know how to get the Perl | |
843 | source distribution. Untar it, change to the extract directory, and | |
844 | .PP | |
845 | .Vb 7 | |
846 | \& gnupatch -p0 < os2\ediff.configure | |
847 | \& sh Configure -des -D prefix=f:/perllib | |
848 | \& make | |
849 | \& make test | |
850 | \& make install | |
851 | \& make aout_test | |
852 | \& make aout_install | |
853 | .Ve | |
854 | .PP | |
855 | This puts the executables in f:/perllib/bin. Manually move them to the | |
856 | \&\f(CW\*(C`PATH\*(C'\fR, manually move the built \fIperl*.dll\fR to \f(CW\*(C`LIBPATH\*(C'\fR (here for | |
857 | Perl \s-1DLL\s0 \fI*\fR is a not-very-meaningful hex checksum), and run | |
858 | .PP | |
859 | .Vb 1 | |
860 | \& make installcmd INSTALLCMDDIR=d:/ir/on/path | |
861 | .Ve | |
862 | .PP | |
863 | Assuming that the \f(CW\*(C`man\*(C'\fR\-files were put on an appropriate location, | |
864 | this completes the installation of minimal Perl system. (The binary | |
865 | distribution contains also a lot of additional modules, and the | |
866 | documentation in \s-1INF\s0 format.) | |
867 | .PP | |
868 | What follows is a detailed guide through these steps. | |
869 | .Sh "Prerequisites" | |
870 | .IX Subsection "Prerequisites" | |
871 | You need to have the latest \s-1EMX\s0 development environment, the full | |
872 | \&\s-1GNU\s0 tool suite (gawk renamed to awk, and \s-1GNU\s0 \fIfind.exe\fR | |
873 | earlier on path than the \s-1OS/2\s0 \fIfind.exe\fR, same with \fIsort.exe\fR, to | |
874 | check use | |
875 | .PP | |
876 | .Vb 2 | |
877 | \& find --version | |
878 | \& sort --version | |
879 | .Ve | |
880 | .PP | |
881 | ). You need the latest version of \fIpdksh\fR installed as \fIsh.exe\fR. | |
882 | .PP | |
883 | Check that you have \fB\s-1BSD\s0\fR libraries and headers installed, and \- | |
884 | optionally \- Berkeley \s-1DB\s0 headers and libraries, and crypt. | |
885 | .PP | |
886 | Possible locations to get the files: | |
887 | .PP | |
888 | .Vb 4 | |
889 | \& ftp://hobbes.nmsu.edu/os2/unix/ | |
890 | \& ftp://ftp.cdrom.com/pub/os2/unix/ | |
891 | \& ftp://ftp.cdrom.com/pub/os2/dev32/ | |
892 | \& ftp://ftp.cdrom.com/pub/os2/emx09c/ | |
893 | .Ve | |
894 | .PP | |
895 | It is reported that the following archives contain enough utils to | |
896 | build perl: \fIgnufutil.zip\fR, \fIgnusutil.zip\fR, \fIgnututil.zip\fR, \fIgnused.zip\fR, | |
897 | \&\fIgnupatch.zip\fR, \fIgnuawk.zip\fR, \fIgnumake.zip\fR, \fIgnugrep.zip\fR, \fIbsddev.zip\fR and | |
898 | \&\fIksh527rt.zip\fR (or a later version). Note that all these utilities are | |
899 | known to be available from \s-1LEO:\s0 | |
900 | .PP | |
901 | .Vb 1 | |
902 | \& ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu | |
903 | .Ve | |
904 | .PP | |
905 | Note also that the \fIdb.lib\fR and \fIdb.a\fR from the \s-1EMX\s0 distribution | |
906 | are not suitable for multi-threaded compile (even single-threaded | |
907 | flavor of Perl uses multi-threaded C \s-1RTL\s0, for | |
908 | compatibility with XFree86\-OS/2). Get a corrected one from | |
909 | .PP | |
910 | .Vb 1 | |
911 | \& http://www.ilyaz.org/software/os2/db_mt.zip | |
912 | .Ve | |
913 | .PP | |
914 | If you have \fIexactly the same version of Perl\fR installed already, | |
915 | make sure that no copies or perl are currently running. Later steps | |
916 | of the build may fail since an older version of \fIperl.dll\fR loaded into | |
917 | memory may be found. Running \f(CW\*(C`make test\*(C'\fR becomes meaningless, since | |
918 | the test are checking a previous build of perl (this situation is detected | |
919 | and reported by \fIlib/os2_base.t\fR test). Do not forget to unset | |
920 | \&\f(CW\*(C`PERL_EMXLOAD_SEC\*(C'\fR in environment. | |
921 | .PP | |
922 | Also make sure that you have \fI/tmp\fR directory on the current drive, | |
923 | and \fI.\fR directory in your \f(CW\*(C`LIBPATH\*(C'\fR. One may try to correct the | |
924 | latter condition by | |
925 | .PP | |
926 | .Vb 1 | |
927 | \& set BEGINLIBPATH .\e. | |
928 | .Ve | |
929 | .PP | |
930 | if you use something like \fI\s-1CMD\s0.EXE\fR or latest versions of | |
931 | \&\fI4os2.exe\fR. (Setting \s-1BEGINLIBPATH\s0 to just \f(CW\*(C`.\*(C'\fR is ignored by the | |
932 | \&\s-1OS/2\s0 kernel.) | |
933 | .PP | |
934 | Make sure your gcc is good for \f(CW\*(C`\-Zomf\*(C'\fR linking: run \f(CW\*(C`omflibs\*(C'\fR | |
935 | script in \fI/emx/lib\fR directory. | |
936 | .PP | |
937 | Check that you have link386 installed. It comes standard with \s-1OS/2\s0, | |
938 | but may be not installed due to customization. If typing | |
939 | .PP | |
940 | .Vb 1 | |
941 | \& link386 | |
942 | .Ve | |
943 | .PP | |
944 | shows you do not have it, do \fISelective install\fR, and choose \f(CW\*(C`Link | |
945 | object modules\*(C'\fR in \fIOptional system utilities/More\fR. If you get into | |
946 | link386 prompts, press \f(CW\*(C`Ctrl\-C\*(C'\fR to exit. | |
947 | .Sh "Getting perl source" | |
948 | .IX Subsection "Getting perl source" | |
949 | You need to fetch the latest perl source (including developers | |
950 | releases). With some probability it is located in | |
951 | .PP | |
952 | .Vb 2 | |
953 | \& http://www.cpan.org/src/5.0 | |
954 | \& http://www.cpan.org/src/5.0/unsupported | |
955 | .Ve | |
956 | .PP | |
957 | If not, you may need to dig in the indices to find it in the directory | |
958 | of the current maintainer. | |
959 | .PP | |
960 | Quick cycle of developers release may break the \s-1OS/2\s0 build time to | |
961 | time, looking into | |
962 | .PP | |
963 | .Vb 1 | |
964 | \& http://www.cpan.org/ports/os2/ | |
965 | .Ve | |
966 | .PP | |
967 | may indicate the latest release which was publicly released by the | |
968 | maintainer. Note that the release may include some additional patches | |
969 | to apply to the current source of perl. | |
970 | .PP | |
971 | Extract it like this | |
972 | .PP | |
973 | .Vb 1 | |
974 | \& tar vzxf perl5.00409.tar.gz | |
975 | .Ve | |
976 | .PP | |
977 | You may see a message about errors while extracting \fIConfigure\fR. This is | |
978 | because there is a conflict with a similarly-named file \fIconfigure\fR. | |
979 | .PP | |
980 | Change to the directory of extraction. | |
981 | .Sh "Application of the patches" | |
982 | .IX Subsection "Application of the patches" | |
983 | You need to apply the patches in \fI./os2/diff.*\fR like this: | |
984 | .PP | |
985 | .Vb 1 | |
986 | \& gnupatch -p0 < os2\ediff.configure | |
987 | .Ve | |
988 | .PP | |
989 | You may also need to apply the patches supplied with the binary | |
990 | distribution of perl. It also makes sense to look on the | |
991 | perl5\-porters mailing list for the latest OS/2\-related patches (see | |
992 | <http://www.xray.mpe.mpg.de/mailing\-lists/perl5\-porters/>). Such | |
993 | patches usually contain strings \f(CW\*(C`/os2/\*(C'\fR and \f(CW\*(C`patch\*(C'\fR, so it makes | |
994 | sense looking for these strings. | |
995 | .Sh "Hand-editing" | |
996 | .IX Subsection "Hand-editing" | |
997 | You may look into the file \fI./hints/os2.sh\fR and correct anything | |
998 | wrong you find there. I do not expect it is needed anywhere. | |
999 | .Sh "Making" | |
1000 | .IX Subsection "Making" | |
1001 | .Vb 1 | |
1002 | \& sh Configure -des -D prefix=f:/perllib | |
1003 | .Ve | |
1004 | .PP | |
1005 | \&\f(CW\*(C`prefix\*(C'\fR means: where to install the resulting perl library. Giving | |
1006 | correct prefix you may avoid the need to specify \f(CW\*(C`PERLLIB_PREFIX\*(C'\fR, | |
1007 | see \*(L"\s-1PERLLIB_PREFIX\s0\*(R". | |
1008 | .PP | |
1009 | \&\fIIgnore the message about missing \f(CI\*(C`ln\*(C'\fI, and about \f(CI\*(C`\-c\*(C'\fI option to | |
1010 | tr\fR. The latter is most probably already fixed, if you see it and can trace | |
1011 | where the latter spurious warning comes from, please inform me. | |
1012 | .PP | |
1013 | Now | |
1014 | .PP | |
1015 | .Vb 1 | |
1016 | \& make | |
1017 | .Ve | |
1018 | .PP | |
1019 | At some moment the built may die, reporting a \fIversion mismatch\fR or | |
1020 | \&\fIunable to run \fIperl\fI\fR. This means that you do not have \fI.\fR in | |
1021 | your \s-1LIBPATH\s0, so \fIperl.exe\fR cannot find the needed \fIperl67B2.dll\fR (treat | |
1022 | these hex digits as line noise). After this is fixed the build | |
1023 | should finish without a lot of fuss. | |
1024 | .Sh "Testing" | |
1025 | .IX Subsection "Testing" | |
1026 | Now run | |
1027 | .PP | |
1028 | .Vb 1 | |
1029 | \& make test | |
1030 | .Ve | |
1031 | .PP | |
1032 | All tests should succeed (with some of them skipped). If you have the | |
1033 | same version of Perl installed, it is crucial that you have \f(CW\*(C`.\*(C'\fR early | |
1034 | in your \s-1LIBPATH\s0 (or in \s-1BEGINLIBPATH\s0), otherwise your tests will most | |
1035 | probably test the wrong version of Perl. | |
1036 | .PP | |
1037 | Some tests may generate extra messages similar to | |
1038 | .ie n .IP "A lot of ""bad free""" 4 | |
1039 | .el .IP "A lot of \f(CWbad free\fR" 4 | |
1040 | .IX Item "A lot of bad free" | |
1041 | in database tests related to Berkeley \s-1DB\s0. \fIThis should be fixed already.\fR | |
1042 | If it persists, you may disable this warnings, see \*(L"\s-1PERL_BADFREE\s0\*(R". | |
1043 | .IP "Process terminated by \s-1SIGTERM/SIGINT\s0" 4 | |
1044 | .IX Item "Process terminated by SIGTERM/SIGINT" | |
1045 | This is a standard message issued by \s-1OS/2\s0 applications. *nix | |
1046 | applications die in silence. It is considered to be a feature. One can | |
1047 | easily disable this by appropriate sighandlers. | |
1048 | .Sp | |
1049 | However the test engine bleeds these message to screen in unexpected | |
1050 | moments. Two messages of this kind \fIshould\fR be present during | |
1051 | testing. | |
1052 | .PP | |
1053 | To get finer test reports, call | |
1054 | .PP | |
1055 | .Vb 1 | |
1056 | \& perl t/harness | |
1057 | .Ve | |
1058 | .PP | |
1059 | The report with \fIio/pipe.t\fR failing may look like this: | |
1060 | .PP | |
1061 | .Vb 5 | |
1062 | \& Failed Test Status Wstat Total Fail Failed List of failed | |
1063 | \& ------------------------------------------------------------ | |
1064 | \& io/pipe.t 12 1 8.33% 9 | |
1065 | \& 7 tests skipped, plus 56 subtests skipped. | |
1066 | \& Failed 1/195 test scripts, 99.49% okay. 1/6542 subtests failed, 99.98% okay. | |
1067 | .Ve | |
1068 | .PP | |
1069 | The reasons for most important skipped tests are: | |
1070 | .IP "\fIop/fs.t\fR" 8 | |
1071 | .IX Item "op/fs.t" | |
1072 | .RS 8 | |
1073 | .PD 0 | |
1074 | .IP "18" 4 | |
1075 | .IX Item "18" | |
1076 | .PD | |
1077 | Checks \f(CW\*(C`atime\*(C'\fR and \f(CW\*(C`mtime\*(C'\fR of \f(CW\*(C`stat()\*(C'\fR \- unfortunately, \s-1HPFS\s0 | |
1078 | provides only 2sec time granularity (for compatibility with \s-1FAT\s0?). | |
1079 | .IP "25" 4 | |
1080 | .IX Item "25" | |
1081 | Checks \f(CW\*(C`truncate()\*(C'\fR on a filehandle just opened for write \- I do not | |
1082 | know why this should or should not work. | |
1083 | .RE | |
1084 | .RS 8 | |
1085 | .RE | |
1086 | .IP "\fIop/stat.t\fR" 8 | |
1087 | .IX Item "op/stat.t" | |
1088 | Checks \f(CW\*(C`stat()\*(C'\fR. Tests: | |
1089 | .RS 8 | |
1090 | .IP "4" 4 | |
1091 | .IX Item "4" | |
1092 | Checks \f(CW\*(C`atime\*(C'\fR and \f(CW\*(C`mtime\*(C'\fR of \f(CW\*(C`stat()\*(C'\fR \- unfortunately, \s-1HPFS\s0 | |
1093 | provides only 2sec time granularity (for compatibility with \s-1FAT\s0?). | |
1094 | .RE | |
1095 | .RS 8 | |
1096 | .RE | |
1097 | .Sh "Installing the built perl" | |
1098 | .IX Subsection "Installing the built perl" | |
1099 | If you haven't yet moved \f(CW\*(C`perl*.dll\*(C'\fR onto \s-1LIBPATH\s0, do it now. | |
1100 | .PP | |
1101 | Run | |
1102 | .PP | |
1103 | .Vb 1 | |
1104 | \& make install | |
1105 | .Ve | |
1106 | .PP | |
1107 | It would put the generated files into needed locations. Manually put | |
1108 | \&\fIperl.exe\fR, \fIperl_\|_.exe\fR and \fIperl_\|__.exe\fR to a location on your | |
1109 | \&\s-1PATH\s0, \fIperl.dll\fR to a location on your \s-1LIBPATH\s0. | |
1110 | .PP | |
1111 | Run | |
1112 | .PP | |
1113 | .Vb 1 | |
1114 | \& make installcmd INSTALLCMDDIR=d:/ir/on/path | |
1115 | .Ve | |
1116 | .PP | |
1117 | to convert perl utilities to \fI.cmd\fR files and put them on | |
1118 | \&\s-1PATH\s0. You need to put \fI.EXE\fR\-utilities on path manually. They are | |
1119 | installed in \f(CW\*(C`$prefix/bin\*(C'\fR, here \f(CW$prefix\fR is what you gave to | |
1120 | \&\fIConfigure\fR, see Making. | |
1121 | .PP | |
1122 | If you use \f(CW\*(C`man\*(C'\fR, either move the installed \fI*/man/\fR directories to | |
1123 | your \f(CW\*(C`MANPATH\*(C'\fR, or modify \f(CW\*(C`MANPATH\*(C'\fR to match the location. (One | |
1124 | could have avoided this by providing a correct \f(CW\*(C`manpath\*(C'\fR option to | |
1125 | \&\fI./Configure\fR, or editing \fI./config.sh\fR between configuring and | |
1126 | making steps.) | |
1127 | .ie n .Sh """a.out""\-style build" | |
1128 | .el .Sh "\f(CWa.out\fP\-style build" | |
1129 | .IX Subsection "a.out-style build" | |
1130 | Proceed as above, but make \fIperl_.exe\fR (see \*(L"perl_.exe\*(R") by | |
1131 | .PP | |
1132 | .Vb 1 | |
1133 | \& make perl_ | |
1134 | .Ve | |
1135 | .PP | |
1136 | test and install by | |
1137 | .PP | |
1138 | .Vb 2 | |
1139 | \& make aout_test | |
1140 | \& make aout_install | |
1141 | .Ve | |
1142 | .PP | |
1143 | Manually put \fIperl_.exe\fR to a location on your \s-1PATH\s0. | |
1144 | .PP | |
1145 | \&\fBNote.\fR The build process for \f(CW\*(C`perl_\*(C'\fR \fIdoes not know\fR about all the | |
1146 | dependencies, so you should make sure that anything is up\-to\-date, | |
1147 | say, by doing | |
1148 | .PP | |
1149 | .Vb 1 | |
1150 | \& make perl_dll | |
1151 | .Ve | |
1152 | .PP | |
1153 | first. | |
1154 | .SH "Building a binary distribution" | |
1155 | .IX Header "Building a binary distribution" | |
1156 | [This section provides a short overview only...] | |
1157 | .PP | |
1158 | Building should proceed differently depending on whether the version of perl | |
1159 | you install is already present and used on your system, or is a new version | |
1160 | not yet used. The description below assumes that the version is new, so | |
1161 | installing its DLLs and \fI.pm\fR files will not disrupt the operation of your | |
1162 | system even if some intermediate steps are not yet fully working. | |
1163 | .PP | |
1164 | The other cases require a little bit more convoluted procedures. Below I | |
1165 | suppose that the current version of Perl is \f(CW5.8.2\fR, so the executables are | |
1166 | named accordingly. | |
1167 | .IP "1." 4 | |
1168 | Fully build and test the Perl distribution. Make sure that no tests are | |
1169 | failing with \f(CW\*(C`test\*(C'\fR and \f(CW\*(C`aout_test\*(C'\fR targets; fix the bugs in Perl and | |
1170 | the Perl test suite detected by these tests. Make sure that \f(CW\*(C`all_test\*(C'\fR | |
1171 | make target runs as clean as possible. Check that \f(CW\*(C`os2/perlrexx.cmd\*(C'\fR | |
1172 | runs fine. | |
1173 | .IP "2." 4 | |
1174 | Fully install Perl, including \f(CW\*(C`installcmd\*(C'\fR target. Copy the generated DLLs | |
1175 | to \f(CW\*(C`LIBPATH\*(C'\fR; copy the numbered Perl executables (as in \fIperl5.8.2.exe\fR) | |
1176 | to \f(CW\*(C`PATH\*(C'\fR; copy \f(CW\*(C`perl_.exe\*(C'\fR to \f(CW\*(C`PATH\*(C'\fR as \f(CW\*(C`perl_5.8.2.exe\*(C'\fR. Think whether | |
1177 | you need backward-compatibility DLLs. In most cases you do not need to install | |
1178 | them yet; but sometime this may simplify the following steps. | |
1179 | .IP "3." 4 | |
1180 | Make sure that \f(CW\*(C`CPAN.pm\*(C'\fR can download files from \s-1CPAN\s0. If not, you may need | |
1181 | to manually install \f(CW\*(C`Net::FTP\*(C'\fR. | |
1182 | .IP "4." 4 | |
1183 | Install the bundle \f(CW\*(C`Bundle::OS2_default\*(C'\fR | |
1184 | .Sp | |
1185 | .Vb 1 | |
1186 | \& perl5.8.2 -MCPAN -e "install Bundle::OS2_default" < nul |& tee 00cpan_i_1 | |
1187 | .Ve | |
1188 | .Sp | |
1189 | This may take a couple of hours on 1GHz processor (when run the first time). | |
1190 | And this should not be necessarily a smooth procedure. Some modules may not | |
1191 | specify required dependencies, so one may need to repeat this procedure several | |
1192 | times until the results stabilize. | |
1193 | .Sp | |
1194 | .Vb 2 | |
1195 | \& perl5.8.2 -MCPAN -e "install Bundle::OS2_default" < nul |& tee 00cpan_i_2 | |
1196 | \& perl5.8.2 -MCPAN -e "install Bundle::OS2_default" < nul |& tee 00cpan_i_3 | |
1197 | .Ve | |
1198 | .Sp | |
1199 | Even after they stabilize, some tests may fail. | |
1200 | .Sp | |
1201 | Fix as many discovered bugs as possible. Document all the bugs which are not | |
1202 | fixed, and all the failures with unknown reasons. Inspect the produced logs | |
1203 | \&\fI00cpan_i_1\fR to find suspiciously skipped tests, and other fishy events. | |
1204 | .Sp | |
1205 | Keep in mind that \fIinstallation\fR of some modules may fail too: for example, | |
1206 | the DLLs to update may be already loaded by \fI\s-1CPAN\s0.pm\fR. Inspect the \f(CW\*(C`install\*(C'\fR | |
1207 | logs (in the example above \fI00cpan_i_1\fR etc) for errors, and install things | |
1208 | manually, as in | |
1209 | .Sp | |
1210 | .Vb 2 | |
1211 | \& cd $CPANHOME/.cpan/build/Digest-MD5-2.31 | |
1212 | \& make install | |
1213 | .Ve | |
1214 | .Sp | |
1215 | Some distributions may fail some tests, but you may want to install them | |
1216 | anyway (as above, or via \f(CW\*(C`force install\*(C'\fR command of \f(CW\*(C`CPAN.pm\*(C'\fR shell\-mode). | |
1217 | .Sp | |
1218 | Since this procedure may take quite a long time to complete, it makes sense | |
1219 | to \*(L"freeze\*(R" your \s-1CPAN\s0 configuration by disabling periodic updates of the | |
1220 | local copy of \s-1CPAN\s0 index: set \f(CW\*(C`index_expire\*(C'\fR to some big value (I use 365), | |
1221 | then save the settings | |
1222 | .Sp | |
1223 | .Vb 2 | |
1224 | \& CPAN> o conf index_expire 365 | |
1225 | \& CPAN> o conf commit | |
1226 | .Ve | |
1227 | .Sp | |
1228 | Reset back to the default value \f(CW1\fR when you are finished. | |
1229 | .IP "5." 4 | |
1230 | When satisfied with the results, rerun the \f(CW\*(C`installcmd\*(C'\fR target. Now you | |
1231 | can copy \f(CW\*(C`perl5.8.2.exe\*(C'\fR to \f(CW\*(C`perl.exe\*(C'\fR, and install the other OMF-build | |
1232 | executables: \f(CW\*(C`perl_\|_.exe\*(C'\fR etc. They are ready to be used. | |
1233 | .IP "6." 4 | |
1234 | Change to the \f(CW\*(C`./pod\*(C'\fR directory of the build tree, download the Perl logo | |
1235 | \&\fICamelGrayBig.BMP\fR, and run | |
1236 | .Sp | |
1237 | .Vb 2 | |
1238 | \& ( perl2ipf > perl.ipf ) |& tee 00ipf | |
1239 | \& ipfc /INF perl.ipf |& tee 00inf | |
1240 | .Ve | |
1241 | .Sp | |
1242 | This produces the Perl docs online book \f(CW\*(C`perl.INF\*(C'\fR. Install in on | |
1243 | \&\f(CW\*(C`BOOKSHELF\*(C'\fR path. | |
1244 | .IP "7." 4 | |
1245 | Now is the time to build statically linked executable \fIperl_.exe\fR which | |
1246 | includes newly-installed via \f(CW\*(C`Bundle::OS2_default\*(C'\fR modules. Doing testing | |
1247 | via \f(CW\*(C`CPAN.pm\*(C'\fR is going to be painfully slow, since it statically links | |
1248 | a new executable per \s-1XS\s0 extension. | |
1249 | .Sp | |
1250 | Here is a possible workaround: create a toplevel \fIMakefile.PL\fR in | |
1251 | \&\fI$CPANHOME/.cpan/build/\fR with contents being (compare with \*(L"Making executables with a custom collection of statically loaded extensions\*(R") | |
1252 | .Sp | |
1253 | .Vb 2 | |
1254 | \& use ExtUtils::MakeMaker; | |
1255 | \& WriteMakefile NAME => 'dummy'; | |
1256 | .Ve | |
1257 | .Sp | |
1258 | execute this as | |
1259 | .Sp | |
1260 | .Vb 2 | |
1261 | \& perl_5.8.2.exe Makefile.PL <nul |& tee 00aout_c1 | |
1262 | \& make -k all test <nul |& 00aout_t1 | |
1263 | .Ve | |
1264 | .Sp | |
1265 | Again, this procedure should not be absolutely smooth. Some \f(CW\*(C`Makefile.PL\*(C'\fR's | |
1266 | in subdirectories may be buggy, and would not run as \*(L"child\*(R" scripts. The | |
1267 | interdependency of modules can strike you; however, since non-XS modules | |
1268 | are already installed, the prerequisites of most modules have a very good | |
1269 | chance to be present. | |
1270 | .Sp | |
1271 | If you discover some glitches, move directories of problematic modules to a | |
1272 | different location; if these modules are non-XS modules, you may just ignore | |
1273 | them \- they are already installed; the remaining, \s-1XS\s0, modules you need to | |
1274 | install manually one by one. | |
1275 | .Sp | |
1276 | After each such removal you need to rerun the \f(CW\*(C`Makefile.PL\*(C'\fR/\f(CW\*(C`make\*(C'\fR process; | |
1277 | usually this procedure converges soon. (But be sure to convert all the | |
1278 | necessary external C libraries from \fI.lib\fR format to \fI.a\fR format: run one of | |
1279 | .Sp | |
1280 | .Vb 2 | |
1281 | \& emxaout foo.lib | |
1282 | \& emximp -o foo.a foo.lib | |
1283 | .Ve | |
1284 | .Sp | |
1285 | whichever is appropriate.) Also, make sure that the DLLs for external | |
1286 | libraries are usable with with executables compiled without \f(CW\*(C`\-Zmtd\*(C'\fR options. | |
1287 | .Sp | |
1288 | When you are sure that only a few subdirectories | |
1289 | lead to failures, you may want to add \f(CW\*(C`\-j4\*(C'\fR option to \f(CW\*(C`make\*(C'\fR to speed up | |
1290 | skipping subdirectories with already finished build. | |
1291 | .Sp | |
1292 | When you are satisfied with the results of tests, install the build C libraries | |
1293 | for extensions: | |
1294 | .Sp | |
1295 | .Vb 1 | |
1296 | \& make install |& tee 00aout_i | |
1297 | .Ve | |
1298 | .Sp | |
1299 | Now you can rename the file \fI./perl.exe\fR generated during the last phase | |
1300 | to \fIperl_5.8.2.exe\fR; place it on \f(CW\*(C`PATH\*(C'\fR; if there is an inter-dependency | |
1301 | between some \s-1XS\s0 modules, you may need to repeat the \f(CW\*(C`test\*(C'\fR/\f(CW\*(C`install\*(C'\fR loop | |
1302 | with this new executable and some excluded modules \- until the procedure | |
1303 | converges. | |
1304 | .Sp | |
1305 | Now you have all the necessary \fI.a\fR libraries for these Perl modules in the | |
1306 | places where Perl builder can find it. Use the perl builder: change to an | |
1307 | empty directory, create a \*(L"dummy\*(R" \fIMakefile.PL\fR again, and run | |
1308 | .Sp | |
1309 | .Vb 2 | |
1310 | \& perl_5.8.2.exe Makefile.PL |& tee 00c | |
1311 | \& make perl |& tee 00p | |
1312 | .Ve | |
1313 | .Sp | |
1314 | This should create an executable \fI./perl.exe\fR with all the statically loaded | |
1315 | extensions built in. Compare the generated \fIperlmain.c\fR files to make sure | |
1316 | that during the iterations the number of loaded extensions only increases. | |
1317 | Rename \fI./perl.exe\fR to \fIperl_5.8.2.exe\fR on \f(CW\*(C`PATH\*(C'\fR. | |
1318 | .Sp | |
1319 | When it converges, you got a functional variant of \fIperl_5.8.2.exe\fR; copy it | |
1320 | to \f(CW\*(C`perl_.exe\*(C'\fR. You are done with generation of the local Perl installation. | |
1321 | .IP "8." 4 | |
1322 | Make sure that the installed modules are actually installed in the location | |
1323 | of the new Perl, and are not inherited from entries of \f(CW@INC\fR given for | |
1324 | inheritance from the older versions of Perl: set \f(CW\*(C`PERLLIB_582_PREFIX\*(C'\fR to | |
1325 | redirect the new version of Perl to a new location, and copy the installed | |
1326 | files to this new location. Redo the tests to make sure that the versions of | |
1327 | modules inherited from older versions of Perl are not needed. | |
1328 | .Sp | |
1329 | Actually, the log output of pod2ipf during the step 6 gives a very detailed | |
1330 | info about which modules are loaded from which place; so you may use it as | |
1331 | an additional verification tool. | |
1332 | .Sp | |
1333 | Check that some temporary files did not make into the perl install tree. | |
1334 | Run something like this | |
1335 | .Sp | |
1336 | .Vb 1 | |
1337 | \& pfind . -f "!(/\e.(pm|pl|ix|al|h|a|lib|txt|pod|imp|bs|dll|ld|bs|inc|xbm|yml|cgi|uu|e2x|skip|packlist|eg|cfg|html|pub|enc|all|ini|po|pot)$/i or /^\ew+$/") | less | |
1338 | .Ve | |
1339 | .Sp | |
1340 | in the install tree (both top one and \fIsitelib\fR one). | |
1341 | .Sp | |
1342 | Compress all the DLLs with \fIlxlite\fR. The tiny \fI.exe\fR can be compressed with | |
1343 | \&\f(CW\*(C`/c:max\*(C'\fR (the bug only appears when there is a fixup in the last 6 bytes of a | |
1344 | page (?); since the tiny executables are much smaller than a page, the bug | |
1345 | will not hit). Do not compress \f(CW\*(C`perl_.exe\*(C'\fR \- it would not work under \s-1DOS\s0. | |
1346 | .IP "9." 4 | |
1347 | Now you can generate the binary distribution. This is done by running the | |
1348 | test of the \s-1CPAN\s0 distribution \f(CW\*(C`OS2::SoftInstaller\*(C'\fR. Tune up the file | |
1349 | \&\fItest.pl\fR to suit the layout of current version of Perl first. Do not | |
1350 | forget to pack the necessary external DLLs accordingly. Include the | |
1351 | description of the bugs and test suite failures you could not fix. Include | |
1352 | the small-stack versions of Perl executables from Perl build directory. | |
1353 | .Sp | |
1354 | Include \fIperl5.def\fR so that people can relink the perl \s-1DLL\s0 preserving | |
1355 | the binary compatibility, or can create compatibility DLLs. Include the diff | |
1356 | files (\f(CW\*(C`diff \-pu old new\*(C'\fR) of fixes you did so that people can rebuild your | |
1357 | version. Include \fIperl5.map\fR so that one can use remote debugging. | |
1358 | .IP "10." 4 | |
1359 | .IX Item "10." | |
1360 | Share what you did with the other people. Relax. Enjoy fruits of your work. | |
1361 | .IP "11." 4 | |
1362 | .IX Item "11." | |
1363 | Brace yourself for thanks, bug reports, hate mail and spam coming as result | |
1364 | of the previous step. No good deed should remain unpunished! | |
1365 | .SH "Building custom \fI.EXE\fP files" | |
1366 | .IX Header "Building custom .EXE files" | |
1367 | The Perl executables can be easily rebuilt at any moment. Moreover, one can | |
1368 | use the \fIembedding\fR interface (see perlembed) to make very customized | |
1369 | executables. | |
1370 | .Sh "Making executables with a custom collection of statically loaded extensions" | |
1371 | .IX Subsection "Making executables with a custom collection of statically loaded extensions" | |
1372 | It is a little bit easier to do so while \fIdecreasing\fR the list of statically | |
1373 | loaded extensions. We discuss this case only here. | |
1374 | .IP "1." 4 | |
1375 | Change to an empty directory, and create a placeholder <Makefile.PL>: | |
1376 | .Sp | |
1377 | .Vb 2 | |
1378 | \& use ExtUtils::MakeMaker; | |
1379 | \& WriteMakefile NAME => 'dummy'; | |
1380 | .Ve | |
1381 | .IP "2." 4 | |
1382 | Run it with the flavor of Perl (\fIperl.exe\fR or \fIperl_.exe\fR) you want to | |
1383 | rebuild. | |
1384 | .Sp | |
1385 | .Vb 1 | |
1386 | \& perl_ Makefile.PL | |
1387 | .Ve | |
1388 | .IP "3." 4 | |
1389 | Ask it to create new Perl executable: | |
1390 | .Sp | |
1391 | .Vb 1 | |
1392 | \& make perl | |
1393 | .Ve | |
1394 | .Sp | |
1395 | (you may need to manually add \f(CW\*(C`PERLTYPE=\-DPERL_CORE\*(C'\fR to this commandline on | |
1396 | some versions of Perl; the symptom is that the command-line globbing does not | |
1397 | work from \s-1OS/2\s0 shells with the newly-compiled executable; check with | |
1398 | .Sp | |
1399 | .Vb 1 | |
1400 | \& .\eperl.exe -wle "print for @ARGV" * | |
1401 | .Ve | |
1402 | .Sp | |
1403 | ). | |
1404 | .IP "4." 4 | |
1405 | The previous step created \fIperlmain.c\fR which contains a list of \fInewXS()\fR calls | |
1406 | near the end. Removing unnecessary calls, and rerunning | |
1407 | .Sp | |
1408 | .Vb 1 | |
1409 | \& make perl | |
1410 | .Ve | |
1411 | .Sp | |
1412 | will produce a customized executable. | |
1413 | .Sh "Making executables with a custom search-paths" | |
1414 | .IX Subsection "Making executables with a custom search-paths" | |
1415 | The default perl executable is flexible enough to support most usages. | |
1416 | However, one may want something yet more flexible; for example, one may want | |
1417 | to find Perl \s-1DLL\s0 relatively to the location of the \s-1EXE\s0 file; or one may want | |
1418 | to ignore the environment when setting the Perl-library search patch, etc. | |
1419 | .PP | |
1420 | If you fill comfortable with \fIembedding\fR interface (see perlembed), such | |
1421 | things are easy to do repeating the steps outlined in \*(L"Making executables with a custom collection of statically loaded extensions\*(R", and | |
1422 | doing more comprehensive edits to \fImain()\fR of \fIperlmain.c\fR. The people with | |
1423 | little desire to understand Perl can just rename \fImain()\fR, and do necessary | |
1424 | modification in a custom \fImain()\fR which calls the renamed function in appropriate | |
1425 | time. | |
1426 | .PP | |
1427 | However, there is a third way: perl \s-1DLL\s0 exports the \fImain()\fR function and several | |
1428 | callbacks to customize the search path. Below is a complete example of a | |
1429 | \&\*(L"Perl loader\*(R" which | |
1430 | .IP "1." 4 | |
1431 | Looks for Perl \s-1DLL\s0 in the directory \f(CW\*(C`$exedir/../dll\*(C'\fR; | |
1432 | .IP "2." 4 | |
1433 | Prepends the above directory to \f(CW\*(C`BEGINLIBPATH\*(C'\fR; | |
1434 | .IP "3." 4 | |
1435 | Fails if the Perl \s-1DLL\s0 found via \f(CW\*(C`BEGINLIBPATH\*(C'\fR is different from what was | |
1436 | loaded on step 1; e.g., another process could have loaded it from \f(CW\*(C`LIBPATH\*(C'\fR | |
1437 | or from a different value of \f(CW\*(C`BEGINLIBPATH\*(C'\fR. In these cases one needs to | |
1438 | modify the setting of the system so that this other process either does not | |
1439 | run, or loads the \s-1DLL\s0 from \f(CW\*(C`BEGINLIBPATH\*(C'\fR with \f(CW\*(C`LIBPATHSTRICT=T\*(C'\fR (available | |
1440 | with kernels after September 2000). | |
1441 | .IP "4." 4 | |
1442 | Loads Perl library from \f(CW\*(C`$exedir/../dll/lib/\*(C'\fR. | |
1443 | .IP "5." 4 | |
1444 | Uses Bourne shell from \f(CW\*(C`$exedir/../dll/sh/ksh.exe\*(C'\fR. | |
1445 | .PP | |
1446 | For best results compile the C file below with the same options as the Perl | |
1447 | \&\s-1DLL\s0. However, a lot of functionality will work even if the executable is not | |
1448 | an \s-1EMX\s0 applications, e.g., if compiled with | |
1449 | .PP | |
1450 | .Vb 1 | |
1451 | \& gcc -Wall -DDOSISH -DOS2=1 -O2 -s -Zomf -Zsys perl-starter.c -DPERL_DLL_BASENAME=\e"perl312F\e" -Zstack 8192 -Zlinker /PM:VIO | |
1452 | .Ve | |
1453 | .PP | |
1454 | Here is the sample C file: | |
1455 | .PP | |
1456 | .Vb 5 | |
1457 | \& #define INCL_DOS | |
1458 | \& #define INCL_NOPM | |
1459 | \& /* These are needed for compile if os2.h includes os2tk.h, not os2emx.h */ | |
1460 | \& #define INCL_DOSPROCESS | |
1461 | \& #include <os2.h> | |
1462 | .Ve | |
1463 | .PP | |
1464 | .Vb 3 | |
1465 | \& #include "EXTERN.h" | |
1466 | \& #define PERL_IN_MINIPERLMAIN_C | |
1467 | \& #include "perl.h" | |
1468 | .Ve | |
1469 | .PP | |
1470 | .Vb 2 | |
1471 | \& static char *me; | |
1472 | \& HMODULE handle; | |
1473 | .Ve | |
1474 | .PP | |
1475 | .Vb 5 | |
1476 | \& static void | |
1477 | \& die_with(char *msg1, char *msg2, char *msg3, char *msg4) | |
1478 | \& { | |
1479 | \& ULONG c; | |
1480 | \& char *s = " error: "; | |
1481 | .Ve | |
1482 | .PP | |
1483 | .Vb 9 | |
1484 | \& DosWrite(2, me, strlen(me), &c); | |
1485 | \& DosWrite(2, s, strlen(s), &c); | |
1486 | \& DosWrite(2, msg1, strlen(msg1), &c); | |
1487 | \& DosWrite(2, msg2, strlen(msg2), &c); | |
1488 | \& DosWrite(2, msg3, strlen(msg3), &c); | |
1489 | \& DosWrite(2, msg4, strlen(msg4), &c); | |
1490 | \& DosWrite(2, "\er\en", 2, &c); | |
1491 | \& exit(255); | |
1492 | \& } | |
1493 | .Ve | |
1494 | .PP | |
1495 | .Vb 3 | |
1496 | \& typedef ULONG (*fill_extLibpath_t)(int type, char *pre, char *post, int replace, char *msg); | |
1497 | \& typedef int (*main_t)(int type, char *argv[], char *env[]); | |
1498 | \& typedef int (*handler_t)(void* data, int which); | |
1499 | .Ve | |
1500 | .PP | |
1501 | .Vb 3 | |
1502 | \& #ifndef PERL_DLL_BASENAME | |
1503 | \& # define PERL_DLL_BASENAME "perl" | |
1504 | \& #endif | |
1505 | .Ve | |
1506 | .PP | |
1507 | .Vb 8 | |
1508 | \& static HMODULE | |
1509 | \& load_perl_dll(char *basename) | |
1510 | \& { | |
1511 | \& char buf[300], fail[260]; | |
1512 | \& STRLEN l, dirl; | |
1513 | \& fill_extLibpath_t f; | |
1514 | \& ULONG rc_fullname; | |
1515 | \& HMODULE handle, handle1; | |
1516 | .Ve | |
1517 | .PP | |
1518 | .Vb 34 | |
1519 | \& if (_execname(buf, sizeof(buf) - 13) != 0) | |
1520 | \& die_with("Can't find full path: ", strerror(errno), "", ""); | |
1521 | \& /* XXXX Fill `me' with new value */ | |
1522 | \& l = strlen(buf); | |
1523 | \& while (l && buf[l-1] != '/' && buf[l-1] != '\e\e') | |
1524 | \& l--; | |
1525 | \& dirl = l - 1; | |
1526 | \& strcpy(buf + l, basename); | |
1527 | \& l += strlen(basename); | |
1528 | \& strcpy(buf + l, ".dll"); | |
1529 | \& if ( (rc_fullname = DosLoadModule(fail, sizeof fail, buf, &handle)) != 0 | |
1530 | \& && DosLoadModule(fail, sizeof fail, basename, &handle) != 0 ) | |
1531 | \& die_with("Can't load DLL ", buf, "", ""); | |
1532 | \& if (rc_fullname) | |
1533 | \& return handle; /* was loaded with short name; all is fine */ | |
1534 | \& if (DosQueryProcAddr(handle, 0, "fill_extLibpath", (PFN*)&f)) | |
1535 | \& die_with(buf, ": DLL exports no symbol ", "fill_extLibpath", ""); | |
1536 | \& buf[dirl] = 0; | |
1537 | \& if (f(0 /*BEGINLIBPATH*/, buf /* prepend */, NULL /* append */, | |
1538 | \& 0 /* keep old value */, me)) | |
1539 | \& die_with(me, ": prepending BEGINLIBPATH", "", ""); | |
1540 | \& if (DosLoadModule(fail, sizeof fail, basename, &handle1) != 0) | |
1541 | \& die_with(me, ": finding perl DLL again via BEGINLIBPATH", "", ""); | |
1542 | \& buf[dirl] = '\e\e'; | |
1543 | \& if (handle1 != handle) { | |
1544 | \& if (DosQueryModuleName(handle1, sizeof(fail), fail)) | |
1545 | \& strcpy(fail, "???"); | |
1546 | \& die_with(buf, ":\en\etperl DLL via BEGINLIBPATH is different: \en\et", | |
1547 | \& fail, | |
1548 | \& "\en\etYou may need to manipulate global BEGINLIBPATH and LIBPATHSTRICT" | |
1549 | \& "\en\etso that the other copy is loaded via BEGINLIBPATH."); | |
1550 | \& } | |
1551 | \& return handle; | |
1552 | \& } | |
1553 | .Ve | |
1554 | .PP | |
1555 | .Vb 5 | |
1556 | \& int | |
1557 | \& main(int argc, char **argv, char **env) | |
1558 | \& { | |
1559 | \& main_t f; | |
1560 | \& handler_t h; | |
1561 | .Ve | |
1562 | .PP | |
1563 | .Vb 3 | |
1564 | \& me = argv[0]; | |
1565 | \& /**/ | |
1566 | \& handle = load_perl_dll(PERL_DLL_BASENAME); | |
1567 | .Ve | |
1568 | .PP | |
1569 | .Vb 6 | |
1570 | \& if (DosQueryProcAddr(handle, 0, "Perl_OS2_handler_install", (PFN*)&h)) | |
1571 | \& die_with(PERL_DLL_BASENAME, ": DLL exports no symbol ", "Perl_OS2_handler_install", ""); | |
1572 | \& if ( !h((void *)"~installprefix", Perlos2_handler_perllib_from) | |
1573 | \& || !h((void *)"~dll", Perlos2_handler_perllib_to) | |
1574 | \& || !h((void *)"~dll/sh/ksh.exe", Perlos2_handler_perl_sh) ) | |
1575 | \& die_with(PERL_DLL_BASENAME, ": Can't install @INC manglers", "", ""); | |
1576 | .Ve | |
1577 | .PP | |
1578 | .Vb 4 | |
1579 | \& if (DosQueryProcAddr(handle, 0, "dll_perlmain", (PFN*)&f)) | |
1580 | \& die_with(PERL_DLL_BASENAME, ": DLL exports no symbol ", "dll_perlmain", ""); | |
1581 | \& return f(argc, argv, env); | |
1582 | \& } | |
1583 | .Ve | |
1584 | .SH "Build FAQ" | |
1585 | .IX Header "Build FAQ" | |
1586 | .ie n .Sh "Some ""/""\fP became \f(CW""\e"" in pdksh." | |
1587 | .el .Sh "Some \f(CW/\fP became \f(CW\e\fP in pdksh." | |
1588 | .IX Subsection "Some / became in pdksh." | |
1589 | You have a very old pdksh. See Prerequisites. | |
1590 | .ie n .Sh "'errno' \- unresolved external" | |
1591 | .el .Sh "\f(CW'errno'\fP \- unresolved external" | |
1592 | .IX Subsection "'errno' - unresolved external" | |
1593 | You do not have MT-safe \fIdb.lib\fR. See Prerequisites. | |
1594 | .Sh "Problems with tr or sed" | |
1595 | .IX Subsection "Problems with tr or sed" | |
1596 | reported with very old version of tr and sed. | |
1597 | .Sh "Some problem (forget which ;\-)" | |
1598 | .IX Subsection "Some problem (forget which ;-)" | |
1599 | You have an older version of \fIperl.dll\fR on your \s-1LIBPATH\s0, which | |
1600 | broke the build of extensions. | |
1601 | .Sh "Library ... not found" | |
1602 | .IX Subsection "Library ... not found" | |
1603 | You did not run \f(CW\*(C`omflibs\*(C'\fR. See Prerequisites. | |
1604 | .Sh "Segfault in make" | |
1605 | .IX Subsection "Segfault in make" | |
1606 | You use an old version of \s-1GNU\s0 make. See Prerequisites. | |
1607 | .Sh "op/sprintf test failure" | |
1608 | .IX Subsection "op/sprintf test failure" | |
1609 | This can result from a bug in emx sprintf which was fixed in 0.9d fix 03. | |
1610 | .SH "Specific (mis)features of OS/2 port" | |
1611 | .IX Header "Specific (mis)features of OS/2 port" | |
1612 | .ie n .Sh """setpriority""\fP, \f(CW""getpriority""" | |
1613 | .el .Sh "\f(CWsetpriority\fP, \f(CWgetpriority\fP" | |
1614 | .IX Subsection "setpriority, getpriority" | |
1615 | Note that these functions are compatible with *nix, not with the older | |
1616 | ports of '94 \- 95. The priorities are absolute, go from 32 to \-95, | |
1617 | lower is quicker. 0 is the default priority. | |
1618 | .PP | |
1619 | \&\fB\s-1WARNING\s0\fR. Calling \f(CW\*(C`getpriority\*(C'\fR on a non-existing process could lock | |
1620 | the system before Warp3 fixpak22. Starting with Warp3, Perl will use | |
1621 | a workaround: it aborts \fIgetpriority()\fR if the process is not present. | |
1622 | This is not possible on older versions \f(CW\*(C`2.*\*(C'\fR, and has a race | |
1623 | condition anyway. | |
1624 | .ie n .Sh """system()""" | |
1625 | .el .Sh "\f(CWsystem()\fP" | |
1626 | .IX Subsection "system()" | |
1627 | Multi-argument form of \f(CW\*(C`system()\*(C'\fR allows an additional numeric | |
1628 | argument. The meaning of this argument is described in | |
1629 | OS2::Process. | |
1630 | .PP | |
1631 | When finding a program to run, Perl first asks the \s-1OS\s0 to look for executables | |
1632 | on \f(CW\*(C`PATH\*(C'\fR (\s-1OS/2\s0 adds extension \fI.exe\fR if no extension is present). | |
1633 | If not found, it looks for a script with possible extensions | |
1634 | added in this order: no extension, \fI.cmd\fR, \fI.btm\fR, | |
1635 | \&\fI.bat\fR, \fI.pl\fR. If found, Perl checks the start of the file for magic | |
1636 | strings \f(CW"#!"\fR and \f(CW"extproc "\fR. If found, Perl uses the rest of the | |
1637 | first line as the beginning of the command line to run this script. The | |
1638 | only mangling done to the first line is extraction of arguments (currently | |
1639 | up to 3), and ignoring of the path-part of the \*(L"interpreter\*(R" name if it can't | |
1640 | be found using the full path. | |
1641 | .PP | |
1642 | E.g., \f(CW\*(C`system 'foo', 'bar', 'baz'\*(C'\fR may lead Perl to finding | |
1643 | \&\fIC:/emx/bin/foo.cmd\fR with the first line being | |
1644 | .PP | |
1645 | .Vb 1 | |
1646 | \& extproc /bin/bash -x -c | |
1647 | .Ve | |
1648 | .PP | |
1649 | If \fI/bin/bash.exe\fR is not found, then Perl looks for an executable \fIbash.exe\fR on | |
1650 | \&\f(CW\*(C`PATH\*(C'\fR. If found in \fIC:/emx.add/bin/bash.exe\fR, then the above \fIsystem()\fR is | |
1651 | translated to | |
1652 | .PP | |
1653 | .Vb 1 | |
1654 | \& system qw(C:/emx.add/bin/bash.exe -x -c C:/emx/bin/foo.cmd bar baz) | |
1655 | .Ve | |
1656 | .PP | |
1657 | One additional translation is performed: instead of \fI/bin/sh\fR Perl uses | |
1658 | the hardwired-or-customized shell (see \f(CW\*(C`\*(L"\s-1PERL_SH_DIR\s0\*(R"\*(C'\fR). | |
1659 | .PP | |
1660 | The above search for \*(L"interpreter\*(R" is recursive: if \fIbash\fR executable is not | |
1661 | found, but \fIbash.btm\fR is found, Perl will investigate its first line etc. | |
1662 | The only hardwired limit on the recursion depth is implicit: there is a limit | |
1663 | 4 on the number of additional arguments inserted before the actual arguments | |
1664 | given to \fIsystem()\fR. In particular, if no additional arguments are specified | |
1665 | on the \*(L"magic\*(R" first lines, then the limit on the depth is 4. | |
1666 | .PP | |
1667 | If Perl finds that the found executable is of \s-1PM\s0 type when the | |
1668 | current session is not, it will start the new process in a separate session of | |
1669 | necessary type. Call via \f(CW\*(C`OS2::Process\*(C'\fR to disable this magic. | |
1670 | .PP | |
1671 | \&\fB\s-1WARNING\s0\fR. Due to the described logic, you need to explicitly | |
1672 | specify \fI.com\fR extension if needed. Moreover, if the executable | |
1673 | \&\fIperl5.6.1\fR is requested, Perl will not look for \fIperl5.6.1.exe\fR. | |
1674 | [This may change in the future.] | |
1675 | .ie n .Sh """extproc"" on the first line" | |
1676 | .el .Sh "\f(CWextproc\fP on the first line" | |
1677 | .IX Subsection "extproc on the first line" | |
1678 | If the first chars of a Perl script are \f(CW"extproc "\fR, this line is treated | |
1679 | as \f(CW\*(C`#!\*(C'\fR\-line, thus all the switches on this line are processed (twice | |
1680 | if script was started via cmd.exe). See \*(L"\s-1DESCRIPTION\s0\*(R" in perlrun. | |
1681 | .Sh "Additional modules:" | |
1682 | .IX Subsection "Additional modules:" | |
1683 | OS2::Process, \s-1OS2::DLL\s0, \s-1OS2::REXX\s0, OS2::PrfDB, OS2::ExtAttr. These | |
1684 | modules provide access to additional numeric argument for \f(CW\*(C`system\*(C'\fR | |
1685 | and to the information about the running process, | |
1686 | to DLLs having functions with \s-1REXX\s0 signature and to the \s-1REXX\s0 runtime, to | |
1687 | \&\s-1OS/2\s0 databases in the \fI.INI\fR format, and to Extended Attributes. | |
1688 | .PP | |
1689 | Two additional extensions by Andreas Kaiser, \f(CW\*(C`OS2::UPM\*(C'\fR, and | |
1690 | \&\f(CW\*(C`OS2::FTP\*(C'\fR, are included into \f(CW\*(C`ILYAZ\*(C'\fR directory, mirrored on \s-1CPAN\s0. | |
1691 | Other OS/2\-related extensions are available too. | |
1692 | .Sh "Prebuilt methods:" | |
1693 | .IX Subsection "Prebuilt methods:" | |
1694 | .ie n .IP """File::Copy::syscopy""" 4 | |
1695 | .el .IP "\f(CWFile::Copy::syscopy\fR" 4 | |
1696 | .IX Item "File::Copy::syscopy" | |
1697 | used by \f(CW\*(C`File::Copy::copy\*(C'\fR, see File::Copy. | |
1698 | .ie n .IP """DynaLoader::mod2fname""" 4 | |
1699 | .el .IP "\f(CWDynaLoader::mod2fname\fR" 4 | |
1700 | .IX Item "DynaLoader::mod2fname" | |
1701 | used by \f(CW\*(C`DynaLoader\*(C'\fR for \s-1DLL\s0 name mangling. | |
1702 | .ie n .IP """Cwd::current_drive()""" 4 | |
1703 | .el .IP "\f(CWCwd::current_drive()\fR" 4 | |
1704 | .IX Item "Cwd::current_drive()" | |
1705 | Self explanatory. | |
1706 | .ie n .IP """Cwd::sys_chdir(name)""" 4 | |
1707 | .el .IP "\f(CWCwd::sys_chdir(name)\fR" 4 | |
1708 | .IX Item "Cwd::sys_chdir(name)" | |
1709 | leaves drive as it is. | |
1710 | .ie n .IP """Cwd::change_drive(name)""" 4 | |
1711 | .el .IP "\f(CWCwd::change_drive(name)\fR" 4 | |
1712 | .IX Item "Cwd::change_drive(name)" | |
1713 | chanes the \*(L"current\*(R" drive. | |
1714 | .ie n .IP """Cwd::sys_is_absolute(name)""" 4 | |
1715 | .el .IP "\f(CWCwd::sys_is_absolute(name)\fR" 4 | |
1716 | .IX Item "Cwd::sys_is_absolute(name)" | |
1717 | means has drive letter and is_rooted. | |
1718 | .ie n .IP """Cwd::sys_is_rooted(name)""" 4 | |
1719 | .el .IP "\f(CWCwd::sys_is_rooted(name)\fR" 4 | |
1720 | .IX Item "Cwd::sys_is_rooted(name)" | |
1721 | means has leading \f(CW\*(C`[/\e\e]\*(C'\fR (maybe after a drive\-letter:). | |
1722 | .ie n .IP """Cwd::sys_is_relative(name)""" 4 | |
1723 | .el .IP "\f(CWCwd::sys_is_relative(name)\fR" 4 | |
1724 | .IX Item "Cwd::sys_is_relative(name)" | |
1725 | means changes with current dir. | |
1726 | .ie n .IP """Cwd::sys_cwd(name)""" 4 | |
1727 | .el .IP "\f(CWCwd::sys_cwd(name)\fR" 4 | |
1728 | .IX Item "Cwd::sys_cwd(name)" | |
1729 | Interface to cwd from \s-1EMX\s0. Used by \f(CW\*(C`Cwd::cwd\*(C'\fR. | |
1730 | .ie n .IP """Cwd::sys_abspath(name, dir)""" 4 | |
1731 | .el .IP "\f(CWCwd::sys_abspath(name, dir)\fR" 4 | |
1732 | .IX Item "Cwd::sys_abspath(name, dir)" | |
1733 | Really really odious function to implement. Returns absolute name of | |
1734 | file which would have \f(CW\*(C`name\*(C'\fR if \s-1CWD\s0 were \f(CW\*(C`dir\*(C'\fR. \f(CW\*(C`Dir\*(C'\fR defaults to the | |
1735 | current dir. | |
1736 | .ie n .IP """Cwd::extLibpath([type])""" 4 | |
1737 | .el .IP "\f(CWCwd::extLibpath([type])\fR" 4 | |
1738 | .IX Item "Cwd::extLibpath([type])" | |
1739 | Get current value of extended library search path. If \f(CW\*(C`type\*(C'\fR is | |
1740 | present and positive, works with \f(CW\*(C`END_LIBPATH\*(C'\fR, if negative, works | |
1741 | with \f(CW\*(C`LIBPATHSTRICT\*(C'\fR, otherwise with \f(CW\*(C`BEGIN_LIBPATH\*(C'\fR. | |
1742 | .ie n .IP """Cwd::extLibpath_set( path [, type ] )""" 4 | |
1743 | .el .IP "\f(CWCwd::extLibpath_set( path [, type ] )\fR" 4 | |
1744 | .IX Item "Cwd::extLibpath_set( path [, type ] )" | |
1745 | Set current value of extended library search path. If \f(CW\*(C`type\*(C'\fR is | |
1746 | present and positive, works with <\s-1END_LIBPATH\s0>, if negative, works | |
1747 | with \f(CW\*(C`LIBPATHSTRICT\*(C'\fR, otherwise with \f(CW\*(C`BEGIN_LIBPATH\*(C'\fR. | |
1748 | .ie n .IP """OS2::Error(do_harderror,do_exception)""" 4 | |
1749 | .el .IP "\f(CWOS2::Error(do_harderror,do_exception)\fR" 4 | |
1750 | .IX Item "OS2::Error(do_harderror,do_exception)" | |
1751 | Returns \f(CW\*(C`undef\*(C'\fR if it was not called yet, otherwise bit 1 is | |
1752 | set if on the previous call do_harderror was enabled, bit | |
1753 | 2 is set if on previous call do_exception was enabled. | |
1754 | .Sp | |
1755 | This function enables/disables error popups associated with | |
1756 | hardware errors (Disk not ready etc.) and software exceptions. | |
1757 | .Sp | |
1758 | I know of no way to find out the state of popups \fIbefore\fR the first call | |
1759 | to this function. | |
1760 | .ie n .IP """OS2::Errors2Drive(drive)""" 4 | |
1761 | .el .IP "\f(CWOS2::Errors2Drive(drive)\fR" 4 | |
1762 | .IX Item "OS2::Errors2Drive(drive)" | |
1763 | Returns \f(CW\*(C`undef\*(C'\fR if it was not called yet, otherwise return false if errors | |
1764 | were not requested to be written to a hard drive, or the drive letter if | |
1765 | this was requested. | |
1766 | .Sp | |
1767 | This function may redirect error popups associated with hardware errors | |
1768 | (Disk not ready etc.) and software exceptions to the file \s-1POPUPLOG\s0.OS2 at | |
1769 | the root directory of the specified drive. Overrides \fIOS2::Error()\fR specified | |
1770 | by individual programs. Given argument undef will disable redirection. | |
1771 | .Sp | |
1772 | Has global effect, persists after the application exits. | |
1773 | .Sp | |
1774 | I know of no way to find out the state of redirection of popups to the disk | |
1775 | \&\fIbefore\fR the first call to this function. | |
1776 | .IP "\fIOS2::SysInfo()\fR" 4 | |
1777 | .IX Item "OS2::SysInfo()" | |
1778 | Returns a hash with system information. The keys of the hash are | |
1779 | .Sp | |
1780 | .Vb 8 | |
1781 | \& MAX_PATH_LENGTH, MAX_TEXT_SESSIONS, MAX_PM_SESSIONS, | |
1782 | \& MAX_VDM_SESSIONS, BOOT_DRIVE, DYN_PRI_VARIATION, | |
1783 | \& MAX_WAIT, MIN_SLICE, MAX_SLICE, PAGE_SIZE, | |
1784 | \& VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, | |
1785 | \& MS_COUNT, TIME_LOW, TIME_HIGH, TOTPHYSMEM, TOTRESMEM, | |
1786 | \& TOTAVAILMEM, MAXPRMEM, MAXSHMEM, TIMER_INTERVAL, | |
1787 | \& MAX_COMP_LENGTH, FOREGROUND_FS_SESSION, | |
1788 | \& FOREGROUND_PROCESS | |
1789 | .Ve | |
1790 | .IP "\fIOS2::BootDrive()\fR" 4 | |
1791 | .IX Item "OS2::BootDrive()" | |
1792 | Returns a letter without colon. | |
1793 | .ie n .IP """OS2::MorphPM(serve)""\fR, \f(CW""OS2::UnMorphPM(serve)""" 4 | |
1794 | .el .IP "\f(CWOS2::MorphPM(serve)\fR, \f(CWOS2::UnMorphPM(serve)\fR" 4 | |
1795 | .IX Item "OS2::MorphPM(serve), OS2::UnMorphPM(serve)" | |
1796 | Transforms the current application into a \s-1PM\s0 application and back. | |
1797 | The argument true means that a real message loop is going to be served. | |
1798 | \&\fIOS2::MorphPM()\fR returns the \s-1PM\s0 message queue handle as an integer. | |
1799 | .Sp | |
1800 | See \*(L"Centralized management of resources\*(R" for additional details. | |
1801 | .ie n .IP """OS2::Serve_Messages(force)""" 4 | |
1802 | .el .IP "\f(CWOS2::Serve_Messages(force)\fR" 4 | |
1803 | .IX Item "OS2::Serve_Messages(force)" | |
1804 | Fake on-demand retrieval of outstanding \s-1PM\s0 messages. If \f(CW\*(C`force\*(C'\fR is false, | |
1805 | will not dispatch messages if a real message loop is known to | |
1806 | be present. Returns number of messages retrieved. | |
1807 | .Sp | |
1808 | Dies with \*(L"QUITing...\*(R" if \s-1WM_QUIT\s0 message is obtained. | |
1809 | .ie n .IP """OS2::Process_Messages(force [, cnt])""" 4 | |
1810 | .el .IP "\f(CWOS2::Process_Messages(force [, cnt])\fR" 4 | |
1811 | .IX Item "OS2::Process_Messages(force [, cnt])" | |
1812 | Retrieval of \s-1PM\s0 messages until window creation/destruction. | |
1813 | If \f(CW\*(C`force\*(C'\fR is false, will not dispatch messages if a real message loop | |
1814 | is known to be present. | |
1815 | .Sp | |
1816 | Returns change in number of windows. If \f(CW\*(C`cnt\*(C'\fR is given, | |
1817 | it is incremented by the number of messages retrieved. | |
1818 | .Sp | |
1819 | Dies with \*(L"QUITing...\*(R" if \s-1WM_QUIT\s0 message is obtained. | |
1820 | .ie n .IP """OS2::_control87(new,mask)""" 4 | |
1821 | .el .IP "\f(CWOS2::_control87(new,mask)\fR" 4 | |
1822 | .IX Item "OS2::_control87(new,mask)" | |
1823 | the same as \fI_control87\fR\|(3) of \s-1EMX\s0. Takes integers as arguments, returns | |
1824 | the previous coprocessor control word as an integer. Only bits in \f(CW\*(C`new\*(C'\fR which | |
1825 | are present in \f(CW\*(C`mask\*(C'\fR are changed in the control word. | |
1826 | .IP "\fIOS2::get_control87()\fR" 4 | |
1827 | .IX Item "OS2::get_control87()" | |
1828 | gets the coprocessor control word as an integer. | |
1829 | .ie n .IP """OS2::set_control87_em(new=MCW_EM,mask=MCW_EM)""" 4 | |
1830 | .el .IP "\f(CWOS2::set_control87_em(new=MCW_EM,mask=MCW_EM)\fR" 4 | |
1831 | .IX Item "OS2::set_control87_em(new=MCW_EM,mask=MCW_EM)" | |
1832 | The variant of \fIOS2::_control87()\fR with default values good for | |
1833 | handling exception mask: if no \f(CW\*(C`mask\*(C'\fR, uses exception mask part of \f(CW\*(C`new\*(C'\fR | |
1834 | only. If no \f(CW\*(C`new\*(C'\fR, disables all the floating point exceptions. | |
1835 | .Sp | |
1836 | See \*(L"Misfeatures\*(R" for details. | |
1837 | .ie n .IP """OS2::DLLname([how [, \e&xsub]])""" 4 | |
1838 | .el .IP "\f(CWOS2::DLLname([how [, \e&xsub]])\fR" 4 | |
1839 | .IX Item "OS2::DLLname([how [, &xsub]])" | |
1840 | Gives the information about the Perl \s-1DLL\s0 or the \s-1DLL\s0 containing the C | |
1841 | function bound to by \f(CW&xsub\fR. The meaning of \f(CW\*(C`how\*(C'\fR is: default (2): | |
1842 | full name; 0: handle; 1: module name. | |
1843 | .PP | |
1844 | (Note that some of these may be moved to different libraries \- | |
1845 | eventually). | |
1846 | .Sh "Prebuilt variables:" | |
1847 | .IX Subsection "Prebuilt variables:" | |
1848 | .IP "$OS2::emx_rev" 4 | |
1849 | .IX Item "$OS2::emx_rev" | |
1850 | numeric value is the same as _emx_rev of \s-1EMX\s0, a string value the same | |
1851 | as _emx_vprt (similar to \f(CW\*(C`0.9c\*(C'\fR). | |
1852 | .IP "$OS2::emx_env" 4 | |
1853 | .IX Item "$OS2::emx_env" | |
1854 | same as _emx_env of \s-1EMX\s0, a number similar to 0x8001. | |
1855 | .IP "$OS2::os_ver" 4 | |
1856 | .IX Item "$OS2::os_ver" | |
1857 | a number \f(CW\*(C`OS_MAJOR + 0.001 * OS_MINOR\*(C'\fR. | |
1858 | .IP "$OS2::is_aout" 4 | |
1859 | .IX Item "$OS2::is_aout" | |
1860 | true if the Perl library was compiled in \s-1AOUT\s0 format. | |
1861 | .IP "$OS2::can_fork" 4 | |
1862 | .IX Item "$OS2::can_fork" | |
1863 | true if the current executable is an \s-1AOUT\s0 \s-1EMX\s0 executable, so Perl can | |
1864 | fork. Do not use this, use the portable check for | |
1865 | \&\f(CW$Config::Config\fR{dfork}. | |
1866 | .IP "$OS2::nsyserror" 4 | |
1867 | .IX Item "$OS2::nsyserror" | |
1868 | This variable (default is 1) controls whether to enforce the contents | |
1869 | of $^E to start with \f(CW\*(C`SYS0003\*(C'\fR\-like id. If set to 0, then the string | |
1870 | value of $^E is what is available from the \s-1OS/2\s0 message file. (Some | |
1871 | messages in this file have an \f(CW\*(C`SYS0003\*(C'\fR\-like id prepended, some not.) | |
1872 | .Sh "Misfeatures" | |
1873 | .IX Subsection "Misfeatures" | |
1874 | .IP "\(bu" 4 | |
1875 | Since \fIflock\fR\|(3) is present in \s-1EMX\s0, but is not functional, it is | |
1876 | emulated by perl. To disable the emulations, set environment variable | |
1877 | \&\f(CW\*(C`USE_PERL_FLOCK=0\*(C'\fR. | |
1878 | .IP "\(bu" 4 | |
1879 | Here is the list of things which may be \*(L"broken\*(R" on | |
1880 | \&\s-1EMX\s0 (from \s-1EMX\s0 docs): | |
1881 | .RS 4 | |
1882 | .IP "\(bu" 4 | |
1883 | The functions \fIrecvmsg\fR\|(3), \fIsendmsg\fR\|(3), and \fIsocketpair\fR\|(3) are not | |
1884 | implemented. | |
1885 | .IP "\(bu" 4 | |
1886 | \&\fIsock_init\fR\|(3) is not required and not implemented. | |
1887 | .IP "\(bu" 4 | |
1888 | \&\fIflock\fR\|(3) is not yet implemented (dummy function). (Perl has a workaround.) | |
1889 | .IP "\(bu" 4 | |
1890 | \&\fIkill\fR\|(3): Special treatment of PID=0, PID=1 and PID=\-1 is not implemented. | |
1891 | .IP "\(bu" 4 | |
1892 | \&\fIwaitpid\fR\|(3): | |
1893 | .Sp | |
1894 | .Vb 3 | |
1895 | \& WUNTRACED | |
1896 | \& Not implemented. | |
1897 | \& waitpid() is not implemented for negative values of PID. | |
1898 | .Ve | |
1899 | .RE | |
1900 | .RS 4 | |
1901 | .Sp | |
1902 | Note that \f(CW\*(C`kill \-9\*(C'\fR does not work with the current version of \s-1EMX\s0. | |
1903 | .RE | |
1904 | .IP "\(bu" 4 | |
1905 | See \*(L"Text\-mode filehandles\*(R". | |
1906 | .IP "\(bu" 4 | |
1907 | Unix-domain sockets on \s-1OS/2\s0 live in a pseudo-file-system \f(CW\*(C`/sockets/...\*(C'\fR. | |
1908 | To avoid a failure to create a socket with a name of a different form, | |
1909 | \&\f(CW"/socket/"\fR is prepended to the socket name (unless it starts with this | |
1910 | already). | |
1911 | .Sp | |
1912 | This may lead to problems later in case the socket is accessed via the | |
1913 | \&\*(L"usual\*(R" file-system calls using the \*(L"initial\*(R" name. | |
1914 | .IP "\(bu" 4 | |
1915 | Apparently, \s-1IBM\s0 used a compiler (for some period of time around '95?) which | |
1916 | changes \s-1FP\s0 mask right and left. This is not \fIthat\fR bad for \s-1IBM\s0's | |
1917 | programs, but the same compiler was used for DLLs which are used with | |
1918 | general-purpose applications. When these DLLs are used, the state of | |
1919 | floating-point flags in the application is not predictable. | |
1920 | .Sp | |
1921 | What is much worse, some DLLs change the floating point flags when in | |
1922 | \&\fI_DLLInitTerm()\fR (e.g., \fI\s-1TCP32IP\s0\fR). This means that even if you do not \fIcall\fR | |
1923 | any function in the \s-1DLL\s0, just the act of loading this \s-1DLL\s0 will reset your | |
1924 | flags. What is worse, the same compiler was used to compile some \s-1HOOK\s0 DLLs. | |
1925 | Given that \s-1HOOK\s0 dlls are executed in the context of \fIall\fR the applications | |
1926 | in the system, this means a complete unpredictablity of floating point | |
1927 | flags on systems using such \s-1HOOK\s0 DLLs. E.g., \fI\s-1GAMESRVR\s0.DLL\fR of \fB\s-1DIVE\s0\fR | |
1928 | origin changes the floating point flags on each write to the \s-1TTY\s0 of a \s-1VIO\s0 | |
1929 | (windowed text\-mode) applications. | |
1930 | .Sp | |
1931 | Some other (not completely debugged) situations when \s-1FP\s0 flags change include | |
1932 | some video drivers (?), and some operations related to creation of the windows. | |
1933 | People who code \fBOpenGL\fR may have more experience on this. | |
1934 | .Sp | |
1935 | Perl is generally used in the situation when all the floating-point | |
1936 | exceptions are ignored, as is the default under \s-1EMX\s0. If they are not ignored, | |
1937 | some benign Perl programs would get a \f(CW\*(C`SIGFPE\*(C'\fR and would die a horrible death. | |
1938 | .Sp | |
1939 | To circumvent this, Perl uses two hacks. They help against \fIone\fR type of | |
1940 | damage only: \s-1FP\s0 flags changed when loading a \s-1DLL\s0. | |
1941 | .Sp | |
1942 | One of the hacks is to disable floating point exceptions on Perl startup (as | |
1943 | is the default with \s-1EMX\s0). This helps only with compile-time-linked DLLs | |
1944 | changing the flags before \fImain()\fR had a chance to be called. | |
1945 | .Sp | |
1946 | The other hack is to restore \s-1FP\s0 flags after a call to \fIdlopen()\fR. This helps | |
1947 | against similar damage done by DLLs \fI_DLLInitTerm()\fR at runtime. Currently | |
1948 | no way to switch these hacks off is provided. | |
1949 | .Sh "Modifications" | |
1950 | .IX Subsection "Modifications" | |
1951 | Perl modifies some standard C library calls in the following ways: | |
1952 | .ie n .IP """popen""" 9 | |
1953 | .el .IP "\f(CWpopen\fR" 9 | |
1954 | .IX Item "popen" | |
1955 | \&\f(CW\*(C`my_popen\*(C'\fR uses \fIsh.exe\fR if shell is required, cf. \*(L"\s-1PERL_SH_DIR\s0\*(R". | |
1956 | .ie n .IP """tmpnam""" 9 | |
1957 | .el .IP "\f(CWtmpnam\fR" 9 | |
1958 | .IX Item "tmpnam" | |
1959 | is created using \f(CW\*(C`TMP\*(C'\fR or \f(CW\*(C`TEMP\*(C'\fR environment variable, via | |
1960 | \&\f(CW\*(C`tempnam\*(C'\fR. | |
1961 | .ie n .IP """tmpfile""" 9 | |
1962 | .el .IP "\f(CWtmpfile\fR" 9 | |
1963 | .IX Item "tmpfile" | |
1964 | If the current directory is not writable, file is created using modified | |
1965 | \&\f(CW\*(C`tmpnam\*(C'\fR, so there may be a race condition. | |
1966 | .ie n .IP """ctermid""" 9 | |
1967 | .el .IP "\f(CWctermid\fR" 9 | |
1968 | .IX Item "ctermid" | |
1969 | a dummy implementation. | |
1970 | .ie n .IP """stat""" 9 | |
1971 | .el .IP "\f(CWstat\fR" 9 | |
1972 | .IX Item "stat" | |
1973 | \&\f(CW\*(C`os2_stat\*(C'\fR special-cases \fI/dev/tty\fR and \fI/dev/con\fR. | |
1974 | .ie n .IP """mkdir""\fR, \f(CW""rmdir""" 9 | |
1975 | .el .IP "\f(CWmkdir\fR, \f(CWrmdir\fR" 9 | |
1976 | .IX Item "mkdir, rmdir" | |
1977 | these \s-1EMX\s0 functions do not work if the path contains a trailing \f(CW\*(C`/\*(C'\fR. | |
1978 | Perl contains a workaround for this. | |
1979 | .ie n .IP """flock""" 9 | |
1980 | .el .IP "\f(CWflock\fR" 9 | |
1981 | .IX Item "flock" | |
1982 | Since \fIflock\fR\|(3) is present in \s-1EMX\s0, but is not functional, it is | |
1983 | emulated by perl. To disable the emulations, set environment variable | |
1984 | \&\f(CW\*(C`USE_PERL_FLOCK=0\*(C'\fR. | |
1985 | .Sh "Identifying DLLs" | |
1986 | .IX Subsection "Identifying DLLs" | |
1987 | All the DLLs built with the current versions of Perl have \s-1ID\s0 strings | |
1988 | identifying the name of the extension, its version, and the version | |
1989 | of Perl required for this \s-1DLL\s0. Run \f(CW\*(C`bldlevel DLL\-name\*(C'\fR to find this | |
1990 | info. | |
1991 | .Sh "Centralized management of resources" | |
1992 | .IX Subsection "Centralized management of resources" | |
1993 | Since to call certain \s-1OS/2\s0 \s-1API\s0 one needs to have a correctly initialized | |
1994 | \&\f(CW\*(C`Win\*(C'\fR subsystem, OS/2\-specific extensions may require getting \f(CW\*(C`HAB\*(C'\fRs and | |
1995 | \&\f(CW\*(C`HMQ\*(C'\fRs. If an extension would do it on its own, another extension could | |
1996 | fail to initialize. | |
1997 | .PP | |
1998 | Perl provides a centralized management of these resources: | |
1999 | .ie n .IP """HAB""" 4 | |
2000 | .el .IP "\f(CWHAB\fR" 4 | |
2001 | .IX Item "HAB" | |
2002 | To get the \s-1HAB\s0, the extension should call \f(CW\*(C`hab = perl_hab_GET()\*(C'\fR in C. After | |
2003 | this call is performed, \f(CW\*(C`hab\*(C'\fR may be accessed as \f(CW\*(C`Perl_hab\*(C'\fR. There is | |
2004 | no need to release the \s-1HAB\s0 after it is used. | |
2005 | .Sp | |
2006 | If by some reasons \fIperl.h\fR cannot be included, use | |
2007 | .Sp | |
2008 | .Vb 1 | |
2009 | \& extern int Perl_hab_GET(void); | |
2010 | .Ve | |
2011 | .Sp | |
2012 | instead. | |
2013 | .ie n .IP """HMQ""" 4 | |
2014 | .el .IP "\f(CWHMQ\fR" 4 | |
2015 | .IX Item "HMQ" | |
2016 | There are two cases: | |
2017 | .RS 4 | |
2018 | .IP "*" 4 | |
2019 | the extension needs an \f(CW\*(C`HMQ\*(C'\fR only because some \s-1API\s0 will not work otherwise. | |
2020 | Use \f(CW\*(C`serve = 0\*(C'\fR below. | |
2021 | .IP "*" 4 | |
2022 | the extension needs an \f(CW\*(C`HMQ\*(C'\fR since it wants to engage in a \s-1PM\s0 event loop. | |
2023 | Use \f(CW\*(C`serve = 1\*(C'\fR below. | |
2024 | .RE | |
2025 | .RS 4 | |
2026 | .Sp | |
2027 | To get an \f(CW\*(C`HMQ\*(C'\fR, the extension should call \f(CW\*(C`hmq = perl_hmq_GET(serve)\*(C'\fR in C. | |
2028 | After this call is performed, \f(CW\*(C`hmq\*(C'\fR may be accessed as \f(CW\*(C`Perl_hmq\*(C'\fR. | |
2029 | .Sp | |
2030 | To signal to Perl that \s-1HMQ\s0 is not needed any more, call | |
2031 | \&\f(CW\*(C`perl_hmq_UNSET(serve)\*(C'\fR. Perl process will automatically morph/unmorph itself | |
2032 | into/from a \s-1PM\s0 process if \s-1HMQ\s0 is needed/not\-needed. Perl will automatically | |
2033 | enable/disable \f(CW\*(C`WM_QUIT\*(C'\fR message during shutdown if the message queue is | |
2034 | served/not\-served. | |
2035 | .Sp | |
2036 | \&\fB\s-1NOTE\s0\fR. If during a shutdown there is a message queue which did not disable | |
2037 | \&\s-1WM_QUIT\s0, and which did not process the received \s-1WM_QUIT\s0 message, the | |
2038 | shutdown will be automatically cancelled. Do not call \f(CWperl_hmq_GET(1)\fR | |
2039 | unless you are going to process messages on an orderly basis. | |
2040 | .RE | |
2041 | .IP "* Treating errors reported by \s-1OS/2\s0 \s-1API\s0" 4 | |
2042 | .IX Item "Treating errors reported by OS/2 API" | |
2043 | There are two principal conventions (it is useful to call them \f(CW\*(C`Dos*\*(C'\fR | |
2044 | and \f(CW\*(C`Win*\*(C'\fR \- though this part of the function signature is not always | |
2045 | determined by the name of the \s-1API\s0) of reporting the error conditions | |
2046 | of \s-1OS/2\s0 \s-1API\s0. Most of \f(CW\*(C`Dos*\*(C'\fR APIs report the error code as the result | |
2047 | of the call (so 0 means success, and there are many types of errors). | |
2048 | Most of \f(CW\*(C`Win*\*(C'\fR \s-1API\s0 report success/fail via the result being | |
2049 | \&\f(CW\*(C`TRUE\*(C'\fR/\f(CW\*(C`FALSE\*(C'\fR; to find the reason for the failure one should call | |
2050 | \&\fIWinGetLastError()\fR \s-1API\s0. | |
2051 | .Sp | |
2052 | Some \f(CW\*(C`Win*\*(C'\fR entry points also overload a \*(L"meaningful\*(R" return value | |
2053 | with the error indicator; having a 0 return value indicates an error. | |
2054 | Yet some other \f(CW\*(C`Win*\*(C'\fR entry points overload things even more, and 0 | |
2055 | return value may mean a successful call returning a valid value 0, as | |
2056 | well as an error condition; in the case of a 0 return value one should | |
2057 | call \fIWinGetLastError()\fR \s-1API\s0 to distinguish a successful call from a | |
2058 | failing one. | |
2059 | .Sp | |
2060 | By convention, all the calls to \s-1OS/2\s0 \s-1API\s0 should indicate their | |
2061 | failures by resetting $^E. All the Perl-accessible functions which | |
2062 | call \s-1OS/2\s0 \s-1API\s0 may be broken into two classes: some \fIdie()\fRs when an \s-1API\s0 | |
2063 | error is encountered, the other report the error via a false return | |
2064 | value (of course, this does not concern Perl-accessible functions | |
2065 | which \fIexpect\fR a failure of the \s-1OS/2\s0 \s-1API\s0 call, having some workarounds | |
2066 | coded). | |
2067 | .Sp | |
2068 | Obviously, in the situation of the last type of the signature of an \s-1OS/2\s0 | |
2069 | \&\s-1API\s0, it is must more convenient for the users if the failure is | |
2070 | indicated by \fIdie()\fRing: one does not need to check $^E to know that | |
2071 | something went wrong. If, however, this solution is not desirable by | |
2072 | some reason, the code in question should reset $^E to 0 before making | |
2073 | this \s-1OS/2\s0 \s-1API\s0 call, so that the caller of this Perl-accessible | |
2074 | function has a chance to distinguish a success\-but\-0\-return value from | |
2075 | a failure. (One may return undef as an alternative way of reporting | |
2076 | an error.) | |
2077 | .Sp | |
2078 | The macros to simplify this type of error propagation are | |
2079 | .RS 4 | |
2080 | .ie n .IP """CheckOSError(expr)""" 4 | |
2081 | .el .IP "\f(CWCheckOSError(expr)\fR" 4 | |
2082 | .IX Item "CheckOSError(expr)" | |
2083 | Returns true on error, sets $^E. Expects \fIexpr()\fR be a call of | |
2084 | \&\f(CW\*(C`Dos*\*(C'\fR\-style \s-1API\s0. | |
2085 | .ie n .IP """CheckWinError(expr)""" 4 | |
2086 | .el .IP "\f(CWCheckWinError(expr)\fR" 4 | |
2087 | .IX Item "CheckWinError(expr)" | |
2088 | Returns true on error, sets $^E. Expects \fIexpr()\fR be a call of | |
2089 | \&\f(CW\*(C`Win*\*(C'\fR\-style \s-1API\s0. | |
2090 | .ie n .IP """SaveWinError(expr)""" 4 | |
2091 | .el .IP "\f(CWSaveWinError(expr)\fR" 4 | |
2092 | .IX Item "SaveWinError(expr)" | |
2093 | Returns \f(CW\*(C`expr\*(C'\fR, sets $^E from \fIWinGetLastError()\fR if \f(CW\*(C`expr\*(C'\fR is false. | |
2094 | .ie n .IP """SaveCroakWinError(expr,die,name1,name2)""" 4 | |
2095 | .el .IP "\f(CWSaveCroakWinError(expr,die,name1,name2)\fR" 4 | |
2096 | .IX Item "SaveCroakWinError(expr,die,name1,name2)" | |
2097 | Returns \f(CW\*(C`expr\*(C'\fR, sets $^E from \fIWinGetLastError()\fR if \f(CW\*(C`expr\*(C'\fR is false, | |
2098 | and \fIdie()\fRs if \f(CW\*(C`die\*(C'\fR and $^E are true. The message to die is the | |
2099 | concatenated strings \f(CW\*(C`name1\*(C'\fR and \f(CW\*(C`name2\*(C'\fR, separated by \f(CW": "\fR from | |
2100 | the contents of $^E. | |
2101 | .ie n .IP """WinError_2_Perl_rc""" 4 | |
2102 | .el .IP "\f(CWWinError_2_Perl_rc\fR" 4 | |
2103 | .IX Item "WinError_2_Perl_rc" | |
2104 | Sets \f(CW\*(C`Perl_rc\*(C'\fR to the return value of \fIWinGetLastError()\fR. | |
2105 | .ie n .IP """FillWinError""" 4 | |
2106 | .el .IP "\f(CWFillWinError\fR" 4 | |
2107 | .IX Item "FillWinError" | |
2108 | Sets \f(CW\*(C`Perl_rc\*(C'\fR to the return value of \fIWinGetLastError()\fR, and sets $^E | |
2109 | to the corresponding value. | |
2110 | .ie n .IP """FillOSError(rc)""" 4 | |
2111 | .el .IP "\f(CWFillOSError(rc)\fR" 4 | |
2112 | .IX Item "FillOSError(rc)" | |
2113 | Sets \f(CW\*(C`Perl_rc\*(C'\fR to \f(CW\*(C`rc\*(C'\fR, and sets $^E to the corresponding value. | |
2114 | .RE | |
2115 | .RS 4 | |
2116 | .RE | |
2117 | .IP "* Loading DLLs and ordinals in DLLs" 4 | |
2118 | .IX Item "Loading DLLs and ordinals in DLLs" | |
2119 | Some DLLs are only present in some versions of \s-1OS/2\s0, or in some | |
2120 | configurations of \s-1OS/2\s0. Some exported entry points are present only | |
2121 | in DLLs shipped with some versions of \s-1OS/2\s0. If these DLLs and entry | |
2122 | points were linked directly for a Perl executable/DLL or from a Perl | |
2123 | extensions, this binary would work only with the specified | |
2124 | versions/setups. Even if these entry points were not needed, the | |
2125 | \&\fIload\fR of the executable (or \s-1DLL\s0) would fail. | |
2126 | .Sp | |
2127 | For example, many newer useful APIs are not present in \s-1OS/2\s0 v2; many | |
2128 | PM-related APIs require DLLs not available on floppy-boot setup. | |
2129 | .Sp | |
2130 | To make these calls fail \fIonly when the calls are executed\fR, one | |
2131 | should call these \s-1API\s0 via a dynamic linking \s-1API\s0. There is a subsystem | |
2132 | in Perl to simplify such type of calls. A large number of entry | |
2133 | points available for such linking is provided (see \f(CW\*(C`entries_ordinals\*(C'\fR | |
2134 | \&\- and also \f(CW\*(C`PMWIN_entries\*(C'\fR \- in \fIos2ish.h\fR). These ordinals can be | |
2135 | accessed via the APIs: | |
2136 | .Sp | |
2137 | .Vb 6 | |
2138 | \& CallORD(), DeclFuncByORD(), DeclVoidFuncByORD(), | |
2139 | \& DeclOSFuncByORD(), DeclWinFuncByORD(), AssignFuncPByORD(), | |
2140 | \& DeclWinFuncByORD_CACHE(), DeclWinFuncByORD_CACHE_survive(), | |
2141 | \& DeclWinFuncByORD_CACHE_resetError_survive(), | |
2142 | \& DeclWinFunc_CACHE(), DeclWinFunc_CACHE_resetError(), | |
2143 | \& DeclWinFunc_CACHE_survive(), DeclWinFunc_CACHE_resetError_survive() | |
2144 | .Ve | |
2145 | .Sp | |
2146 | See the header files and the C code in the supplied OS/2\-related | |
2147 | modules for the details on usage of these functions. | |
2148 | .Sp | |
2149 | Some of these functions also combine dynaloading semantic with the | |
2150 | error-propagation semantic discussed above. | |
2151 | .SH "Perl flavors" | |
2152 | .IX Header "Perl flavors" | |
2153 | Because of idiosyncrasies of \s-1OS/2\s0 one cannot have all the eggs in the | |
2154 | same basket (though \s-1EMX\s0 environment tries hard to overcome this | |
2155 | limitations, so the situation may somehow improve). There are 4 | |
2156 | executables for Perl provided by the distribution: | |
2157 | .Sh "\fIperl.exe\fP" | |
2158 | .IX Subsection "perl.exe" | |
2159 | The main workhorse. This is a chimera executable: it is compiled as an | |
2160 | \&\f(CW\*(C`a.out\*(C'\fR\-style executable, but is linked with \f(CW\*(C`omf\*(C'\fR\-style dynamic | |
2161 | library \fIperl.dll\fR, and with dynamic \s-1CRT\s0 \s-1DLL\s0. This executable is a | |
2162 | \&\s-1VIO\s0 application. | |
2163 | .PP | |
2164 | It can load perl dynamic extensions, and it can \fIfork()\fR. | |
2165 | .PP | |
2166 | \&\fBNote.\fR Keep in mind that \fIfork()\fR is needed to open a pipe to yourself. | |
2167 | .Sh "\fIperl_.exe\fP" | |
2168 | .IX Subsection "perl_.exe" | |
2169 | This is a statically linked \f(CW\*(C`a.out\*(C'\fR\-style executable. It cannot | |
2170 | load dynamic Perl extensions. The executable supplied in binary | |
2171 | distributions has a lot of extensions prebuilt, thus the above restriction is | |
2172 | important only if you use custom-built extensions. This executable is a \s-1VIO\s0 | |
2173 | application. | |
2174 | .PP | |
2175 | \&\fIThis is the only executable with does not require \s-1OS/2\s0.\fR The | |
2176 | friends locked into \f(CW\*(C`M$\*(C'\fR world would appreciate the fact that this | |
2177 | executable runs under \s-1DOS\s0, Win0.3*, Win0.95 and WinNT with an | |
2178 | appropriate extender. See \*(L"Other OSes\*(R". | |
2179 | .Sh "\fIperl_\|_.exe\fP" | |
2180 | .IX Subsection "perl__.exe" | |
2181 | This is the same executable as \fIperl_\|__.exe\fR, but it is a \s-1PM\s0 | |
2182 | application. | |
2183 | .PP | |
2184 | \&\fBNote.\fR Usually (unless explicitly redirected during the startup) | |
2185 | \&\s-1STDIN\s0, \s-1STDERR\s0, and \s-1STDOUT\s0 of a \s-1PM\s0 | |
2186 | application are redirected to \fInul\fR. However, it is possible to \fIsee\fR | |
2187 | them if you start \f(CW\*(C`perl_\|_.exe\*(C'\fR from a \s-1PM\s0 program which emulates a | |
2188 | console window, like \fIShell mode\fR of Emacs or \s-1EPM\s0. Thus it \fIis | |
2189 | possible\fR to use Perl debugger (see perldebug) to debug your \s-1PM\s0 | |
2190 | application (but beware of the message loop lockups \- this will not | |
2191 | work if you have a message queue to serve, unless you hook the serving | |
2192 | into the \fIgetc()\fR function of the debugger). | |
2193 | .PP | |
2194 | Another way to see the output of a \s-1PM\s0 program is to run it as | |
2195 | .PP | |
2196 | .Vb 1 | |
2197 | \& pm_prog args 2>&1 | cat - | |
2198 | .Ve | |
2199 | .PP | |
2200 | with a shell \fIdifferent\fR from \fIcmd.exe\fR, so that it does not create | |
2201 | a link between a \s-1VIO\s0 session and the session of \f(CW\*(C`pm_porg\*(C'\fR. (Such a link | |
2202 | closes the \s-1VIO\s0 window.) E.g., this works with \fIsh.exe\fR \- or with Perl! | |
2203 | .PP | |
2204 | .Vb 2 | |
2205 | \& open P, 'pm_prog args 2>&1 |' or die; | |
2206 | \& print while <P>; | |
2207 | .Ve | |
2208 | .PP | |
2209 | The flavor \fIperl_\|_.exe\fR is required if you want to start your program without | |
2210 | a \s-1VIO\s0 window present, but not \f(CW\*(C`detach\*(C'\fRed (run \f(CW\*(C`help detach\*(C'\fR for more info). | |
2211 | Very useful for extensions which use \s-1PM\s0, like \f(CW\*(C`Perl/Tk\*(C'\fR or \f(CW\*(C`OpenGL\*(C'\fR. | |
2212 | .PP | |
2213 | Note also that the differences between \s-1PM\s0 and \s-1VIO\s0 executables are only | |
2214 | in the \fIdefault\fR behaviour. One can start \fIany\fR executable in | |
2215 | \&\fIany\fR kind of session by using the arguments \f(CW\*(C`/fs\*(C'\fR, \f(CW\*(C`/pm\*(C'\fR or | |
2216 | \&\f(CW\*(C`/win\*(C'\fR switches of the command \f(CW\*(C`start\*(C'\fR (of \fI\s-1CMD\s0.EXE\fR or a similar | |
2217 | shell). Alternatively, one can use the numeric first argument of the | |
2218 | \&\f(CW\*(C`system\*(C'\fR Perl function (see OS2::Process). | |
2219 | .Sh "\fIperl_\|__.exe\fP" | |
2220 | .IX Subsection "perl___.exe" | |
2221 | This is an \f(CW\*(C`omf\*(C'\fR\-style executable which is dynamically linked to | |
2222 | \&\fIperl.dll\fR and \s-1CRT\s0 \s-1DLL\s0. I know no advantages of this executable | |
2223 | over \f(CW\*(C`perl.exe\*(C'\fR, but it cannot \fIfork()\fR at all. Well, one advantage is | |
2224 | that the build process is not so convoluted as with \f(CW\*(C`perl.exe\*(C'\fR. | |
2225 | .PP | |
2226 | It is a \s-1VIO\s0 application. | |
2227 | .Sh "Why strange names?" | |
2228 | .IX Subsection "Why strange names?" | |
2229 | Since Perl processes the \f(CW\*(C`#!\*(C'\fR\-line (cf. | |
2230 | \&\*(L"\s-1DESCRIPTION\s0\*(R" in perlrun, \*(L"Switches\*(R" in perlrun, | |
2231 | \&\*(L"Not a perl script\*(R" in perldiag, | |
2232 | \&\*(L"No Perl script found in input\*(R" in perldiag), it should know when a | |
2233 | program \fIis a Perl\fR. There is some naming convention which allows | |
2234 | Perl to distinguish correct lines from wrong ones. The above names are | |
2235 | almost the only names allowed by this convention which do not contain | |
2236 | digits (which have absolutely different semantics). | |
2237 | .Sh "Why dynamic linking?" | |
2238 | .IX Subsection "Why dynamic linking?" | |
2239 | Well, having several executables dynamically linked to the same huge | |
2240 | library has its advantages, but this would not substantiate the | |
2241 | additional work to make it compile. The reason is the complicated-to-developers | |
2242 | but very quick and convenient-to-users \*(L"hard\*(R" dynamic linking used by \s-1OS/2\s0. | |
2243 | .PP | |
2244 | There are two distinctive features of the dyna-linking model of \s-1OS/2:\s0 | |
2245 | first, all the references to external functions are resolved at the compile time; | |
2246 | second, there is no runtime fixup of the DLLs after they are loaded into memory. | |
2247 | The first feature is an enormous advantage over other models: it avoids | |
2248 | conflicts when several DLLs used by an application export entries with | |
2249 | the same name. In such cases \*(L"other\*(R" models of dyna-linking just choose | |
2250 | between these two entry points using some random criterion \- with predictable | |
2251 | disasters as results. But it is the second feature which requires the build | |
2252 | of \fIperl.dll\fR. | |
2253 | .PP | |
2254 | The address tables of DLLs are patched only once, when they are | |
2255 | loaded. The addresses of the entry points into DLLs are guaranteed to be | |
2256 | the same for all the programs which use the same \s-1DLL\s0. This removes the | |
2257 | runtime fixup \- once \s-1DLL\s0 is loaded, its code is read\-only. | |
2258 | .PP | |
2259 | While this allows some (significant?) performance advantages, this makes life | |
2260 | much harder for developers, since the above scheme makes it impossible | |
2261 | for a \s-1DLL\s0 to be \*(L"linked\*(R" to a symbol in the \fI.EXE\fR file. Indeed, this | |
2262 | would need a \s-1DLL\s0 to have different relocations tables for the | |
2263 | (different) executables which use this \s-1DLL\s0. | |
2264 | .PP | |
2265 | However, a dynamically loaded Perl extension is forced to use some symbols | |
2266 | from the perl | |
2267 | executable, e.g., to know how to find the arguments to the functions: | |
2268 | the arguments live on the perl | |
2269 | internal evaluation stack. The solution is to put the main code of | |
2270 | the interpreter into a \s-1DLL\s0, and make the \fI.EXE\fR file which just loads | |
2271 | this \s-1DLL\s0 into memory and supplies command\-arguments. The extension \s-1DLL\s0 | |
2272 | cannot link to symbols in \fI.EXE\fR, but it has no problem linking | |
2273 | to symbols in the \fI.DLL\fR. | |
2274 | .PP | |
2275 | This \fIgreatly\fR increases the load time for the application (as well as | |
2276 | complexity of the compilation). Since interpreter is in a \s-1DLL\s0, | |
2277 | the C \s-1RTL\s0 is basically forced to reside in a \s-1DLL\s0 as well (otherwise | |
2278 | extensions would not be able to use \s-1CRT\s0). There are some advantages if | |
2279 | you use different flavors of perl, such as running \fIperl.exe\fR and | |
2280 | \&\fIperl_\|_.exe\fR simultaneously: they share the memory of \fIperl.dll\fR. | |
2281 | .PP | |
2282 | \&\fB\s-1NOTE\s0\fR. There is one additional effect which makes DLLs more wasteful: | |
2283 | DLLs are loaded in the shared memory region, which is a scarse resource | |
2284 | given the 512M barrier of the \*(L"standard\*(R" \s-1OS/2\s0 virtual memory. The code of | |
2285 | \&\fI.EXE\fR files is also shared by all the processes which use the particular | |
2286 | \&\fI.EXE\fR, but they are \*(L"shared in the private address space of the process\*(R"; | |
2287 | this is possible because the address at which different sections | |
2288 | of the \fI.EXE\fR file are loaded is decided at compile\-time, thus all the | |
2289 | processes have these sections loaded at same addresses, and no fixup | |
2290 | of internal links inside the \fI.EXE\fR is needed. | |
2291 | .PP | |
2292 | Since DLLs may be loaded at run time, to have the same mechanism for DLLs | |
2293 | one needs to have the address range of \fIany of the loaded\fR DLLs in the | |
2294 | system to be available \fIin all the processes\fR which did not load a particular | |
2295 | \&\s-1DLL\s0 yet. This is why the DLLs are mapped to the shared memory region. | |
2296 | .Sh "Why chimera build?" | |
2297 | .IX Subsection "Why chimera build?" | |
2298 | Current \s-1EMX\s0 environment does not allow DLLs compiled using Unixish | |
2299 | \&\f(CW\*(C`a.out\*(C'\fR format to export symbols for data (or at least some types of | |
2300 | data). This forces \f(CW\*(C`omf\*(C'\fR\-style compile of \fIperl.dll\fR. | |
2301 | .PP | |
2302 | Current \s-1EMX\s0 environment does not allow \fI.EXE\fR files compiled in | |
2303 | \&\f(CW\*(C`omf\*(C'\fR format to \fIfork()\fR. \fIfork()\fR is needed for exactly three Perl | |
2304 | operations: | |
2305 | .IP "\(bu" 4 | |
2306 | explicit \fIfork()\fR in the script, | |
2307 | .IP "\(bu" 4 | |
2308 | \&\f(CW\*(C`open FH, "|\-"\*(C'\fR | |
2309 | .IP "\(bu" 4 | |
2310 | \&\f(CW\*(C`open FH, "\-|"\*(C'\fR, in other words, opening pipes to itself. | |
2311 | .PP | |
2312 | While these operations are not questions of life and death, they are | |
2313 | needed for a lot of | |
2314 | useful scripts. This forces \f(CW\*(C`a.out\*(C'\fR\-style compile of | |
2315 | \&\fIperl.exe\fR. | |
2316 | .SH "ENVIRONMENT" | |
2317 | .IX Header "ENVIRONMENT" | |
2318 | Here we list environment variables with are either \s-1OS/2\-\s0 and \s-1DOS\-\s0 and | |
2319 | Win*\-specific, or are more important under \s-1OS/2\s0 than under other OSes. | |
2320 | .ie n .Sh """PERLLIB_PREFIX""" | |
2321 | .el .Sh "\f(CWPERLLIB_PREFIX\fP" | |
2322 | .IX Subsection "PERLLIB_PREFIX" | |
2323 | Specific for \s-1EMX\s0 port. Should have the form | |
2324 | .PP | |
2325 | .Vb 1 | |
2326 | \& path1;path2 | |
2327 | .Ve | |
2328 | .PP | |
2329 | or | |
2330 | .PP | |
2331 | .Vb 1 | |
2332 | \& path1 path2 | |
2333 | .Ve | |
2334 | .PP | |
2335 | If the beginning of some prebuilt path matches \fIpath1\fR, it is | |
2336 | substituted with \fIpath2\fR. | |
2337 | .PP | |
2338 | Should be used if the perl library is moved from the default | |
2339 | location in preference to \f(CW\*(C`PERL(5)LIB\*(C'\fR, since this would not leave wrong | |
2340 | entries in \f(CW@INC\fR. For example, if the compiled version of perl looks for \f(CW@INC\fR | |
2341 | in \fIf:/perllib/lib\fR, and you want to install the library in | |
2342 | \&\fIh:/opt/gnu\fR, do | |
2343 | .PP | |
2344 | .Vb 1 | |
2345 | \& set PERLLIB_PREFIX=f:/perllib/lib;h:/opt/gnu | |
2346 | .Ve | |
2347 | .PP | |
2348 | This will cause Perl with the prebuilt \f(CW@INC\fR of | |
2349 | .PP | |
2350 | .Vb 5 | |
2351 | \& f:/perllib/lib/5.00553/os2 | |
2352 | \& f:/perllib/lib/5.00553 | |
2353 | \& f:/perllib/lib/site_perl/5.00553/os2 | |
2354 | \& f:/perllib/lib/site_perl/5.00553 | |
2355 | \& . | |
2356 | .Ve | |
2357 | .PP | |
2358 | to use the following \f(CW@INC:\fR | |
2359 | .PP | |
2360 | .Vb 5 | |
2361 | \& h:/opt/gnu/5.00553/os2 | |
2362 | \& h:/opt/gnu/5.00553 | |
2363 | \& h:/opt/gnu/site_perl/5.00553/os2 | |
2364 | \& h:/opt/gnu/site_perl/5.00553 | |
2365 | \& . | |
2366 | .Ve | |
2367 | .ie n .Sh """PERL_BADLANG""" | |
2368 | .el .Sh "\f(CWPERL_BADLANG\fP" | |
2369 | .IX Subsection "PERL_BADLANG" | |
2370 | If 0, perl ignores \fIsetlocale()\fR failing. May be useful with some | |
2371 | strange \fIlocale\fRs. | |
2372 | .ie n .Sh """PERL_BADFREE""" | |
2373 | .el .Sh "\f(CWPERL_BADFREE\fP" | |
2374 | .IX Subsection "PERL_BADFREE" | |
2375 | If 0, perl would not warn of in case of unwarranted \fIfree()\fR. With older | |
2376 | perls this might be | |
2377 | useful in conjunction with the module DB_File, which was buggy when | |
2378 | dynamically linked and OMF\-built. | |
2379 | .PP | |
2380 | Should not be set with newer Perls, since this may hide some \fIreal\fR problems. | |
2381 | .ie n .Sh """PERL_SH_DIR""" | |
2382 | .el .Sh "\f(CWPERL_SH_DIR\fP" | |
2383 | .IX Subsection "PERL_SH_DIR" | |
2384 | Specific for \s-1EMX\s0 port. Gives the directory part of the location for | |
2385 | \&\fIsh.exe\fR. | |
2386 | .ie n .Sh """USE_PERL_FLOCK""" | |
2387 | .el .Sh "\f(CWUSE_PERL_FLOCK\fP" | |
2388 | .IX Subsection "USE_PERL_FLOCK" | |
2389 | Specific for \s-1EMX\s0 port. Since \fIflock\fR\|(3) is present in \s-1EMX\s0, but is not | |
2390 | functional, it is emulated by perl. To disable the emulations, set | |
2391 | environment variable \f(CW\*(C`USE_PERL_FLOCK=0\*(C'\fR. | |
2392 | .ie n .Sh """TMP""\fP or \f(CW""TEMP""" | |
2393 | .el .Sh "\f(CWTMP\fP or \f(CWTEMP\fP" | |
2394 | .IX Subsection "TMP or TEMP" | |
2395 | Specific for \s-1EMX\s0 port. Used as storage place for temporary files. | |
2396 | .SH "Evolution" | |
2397 | .IX Header "Evolution" | |
2398 | Here we list major changes which could make you by surprise. | |
2399 | .Sh "Text-mode filehandles" | |
2400 | .IX Subsection "Text-mode filehandles" | |
2401 | Starting from version 5.8, Perl uses a builtin translation layer for | |
2402 | text-mode files. This replaces the efficient well-tested \s-1EMX\s0 layer by | |
2403 | some code which should be best characterized as a \*(L"quick hack\*(R". | |
2404 | .PP | |
2405 | In addition to possible bugs and an inability to follow changes to the | |
2406 | translation policy with off/on switches of \s-1TERMIO\s0 translation, this | |
2407 | introduces a serious incompatible change: before \fIsysread()\fR on | |
2408 | text-mode filehandles would go through the translation layer, now it | |
2409 | would not. | |
2410 | .Sh "Priorities" | |
2411 | .IX Subsection "Priorities" | |
2412 | \&\f(CW\*(C`setpriority\*(C'\fR and \f(CW\*(C`getpriority\*(C'\fR are not compatible with earlier | |
2413 | ports by Andreas Kaiser. See \f(CW"setpriority, getpriority"\fR. | |
2414 | .Sh "\s-1DLL\s0 name mangling: pre 5.6.2" | |
2415 | .IX Subsection "DLL name mangling: pre 5.6.2" | |
2416 | With the release 5.003_01 the dynamically loadable libraries | |
2417 | should be rebuilt when a different version of Perl is compiled. In particular, | |
2418 | DLLs (including \fIperl.dll\fR) are now created with the names | |
2419 | which contain a checksum, thus allowing workaround for \s-1OS/2\s0 scheme of | |
2420 | caching DLLs. | |
2421 | .PP | |
2422 | It may be possible to code a simple workaround which would | |
2423 | .IP "\(bu" 4 | |
2424 | find the old DLLs looking through the old \f(CW@INC\fR; | |
2425 | .IP "\(bu" 4 | |
2426 | mangle the names according to the scheme of new perl and copy the DLLs to | |
2427 | these names; | |
2428 | .IP "\(bu" 4 | |
2429 | edit the internal \f(CW\*(C`LX\*(C'\fR tables of \s-1DLL\s0 to reflect the change of the name | |
2430 | (probably not needed for Perl extension DLLs, since the internally coded names | |
2431 | are not used for \*(L"specific\*(R" DLLs, they used only for \*(L"global\*(R" DLLs). | |
2432 | .IP "\(bu" 4 | |
2433 | edit the internal \f(CW\*(C`IMPORT\*(C'\fR tables and change the name of the \*(L"old\*(R" | |
2434 | \&\fIperl????.dll\fR to the \*(L"new\*(R" \fIperl????.dll\fR. | |
2435 | .Sh "\s-1DLL\s0 name mangling: 5.6.2 and beyond" | |
2436 | .IX Subsection "DLL name mangling: 5.6.2 and beyond" | |
2437 | In fact mangling of \fIextension\fR DLLs was done due to misunderstanding | |
2438 | of the \s-1OS/2\s0 dynaloading model. \s-1OS/2\s0 (effectively) maintains two | |
2439 | different tables of loaded \s-1DLL:\s0 | |
2440 | .IP "Global DLLs" 4 | |
2441 | .IX Item "Global DLLs" | |
2442 | those loaded by the base name from \f(CW\*(C`LIBPATH\*(C'\fR; including those | |
2443 | associated at link time; | |
2444 | .IP "specific DLLs" 4 | |
2445 | .IX Item "specific DLLs" | |
2446 | loaded by the full name. | |
2447 | .PP | |
2448 | When resolving a request for a global \s-1DLL\s0, the table of already-loaded | |
2449 | specific DLLs is (effectively) ignored; moreover, specific DLLs are | |
2450 | \&\fIalways\fR loaded from the prescribed path. | |
2451 | .PP | |
2452 | There is/was a minor twist which makes this scheme fragile: what to do | |
2453 | with DLLs loaded from | |
2454 | .ie n .IP """BEGINLIBPATH""\fR and \f(CW""ENDLIBPATH""" 4 | |
2455 | .el .IP "\f(CWBEGINLIBPATH\fR and \f(CWENDLIBPATH\fR" 4 | |
2456 | .IX Item "BEGINLIBPATH and ENDLIBPATH" | |
2457 | (which depend on the process) | |
2458 | .ie n .IP "\fI.\fR from ""LIBPATH""" 4 | |
2459 | .el .IP "\fI.\fR from \f(CWLIBPATH\fR" 4 | |
2460 | .IX Item ". from LIBPATH" | |
2461 | which \fIeffectively\fR depends on the process (although \f(CW\*(C`LIBPATH\*(C'\fR is the | |
2462 | same for all the processes). | |
2463 | .PP | |
2464 | Unless \f(CW\*(C`LIBPATHSTRICT\*(C'\fR is set to \f(CW\*(C`T\*(C'\fR (and the kernel is after | |
2465 | 2000/09/01), such DLLs are considered to be global. When loading a | |
2466 | global \s-1DLL\s0 it is first looked in the table of already-loaded global | |
2467 | DLLs. Because of this the fact that one executable loaded a \s-1DLL\s0 from | |
2468 | \&\f(CW\*(C`BEGINLIBPATH\*(C'\fR and \f(CW\*(C`ENDLIBPATH\*(C'\fR, or \fI.\fR from \f(CW\*(C`LIBPATH\*(C'\fR may affect | |
2469 | \&\fIwhich\fR \s-1DLL\s0 is loaded when \fIanother\fR executable requests a \s-1DLL\s0 with | |
2470 | the same name. \fIThis\fR is the reason for version-specific mangling of | |
2471 | the \s-1DLL\s0 name for perl \s-1DLL\s0. | |
2472 | .PP | |
2473 | Since the Perl extension DLLs are always loaded with the full path, | |
2474 | there is no need to mangle their names in a version-specific ways: | |
2475 | their directory already reflects the corresponding version of perl, | |
2476 | and \f(CW@INC\fR takes into account binary compatibility with older version. | |
2477 | Starting from \f(CW5.6.2\fR the name mangling scheme is fixed to be the | |
2478 | same as for Perl 5.005_53 (same as in a popular binary release). Thus | |
2479 | new Perls will be able to \fIresolve the names\fR of old extension DLLs | |
2480 | if \f(CW@INC\fR allows finding their directories. | |
2481 | .PP | |
2482 | However, this still does not guarantee that these \s-1DLL\s0 may be loaded. | |
2483 | The reason is the mangling of the name of the \fIPerl \s-1DLL\s0\fR. And since | |
2484 | the extension DLLs link with the Perl \s-1DLL\s0, extension DLLs for older | |
2485 | versions would load an older Perl \s-1DLL\s0, and would most probably | |
2486 | segfault (since the data in this \s-1DLL\s0 is not properly initialized). | |
2487 | .PP | |
2488 | There is a partial workaround (which can be made complete with newer | |
2489 | \&\s-1OS/2\s0 kernels): create a forwarder \s-1DLL\s0 with the same name as the \s-1DLL\s0 of | |
2490 | the older version of Perl, which forwards the entry points to the | |
2491 | newer Perl's \s-1DLL\s0. Make this \s-1DLL\s0 accessible on (say) the \f(CW\*(C`BEGINLIBPATH\*(C'\fR of | |
2492 | the new Perl executable. When the new executable accesses old Perl's | |
2493 | extension DLLs, they would request the old Perl's \s-1DLL\s0 by name, get the | |
2494 | forwarder instead, so effectively will link with the currently running | |
2495 | (new) Perl \s-1DLL\s0. | |
2496 | .PP | |
2497 | This may break in two ways: | |
2498 | .IP "\(bu" 4 | |
2499 | Old perl executable is started when a new executable is running has | |
2500 | loaded an extension compiled for the old executable (ouph!). In this | |
2501 | case the old executable will get a forwarder \s-1DLL\s0 instead of the old | |
2502 | perl \s-1DLL\s0, so would link with the new perl \s-1DLL\s0. While not directly | |
2503 | fatal, it will behave the same as new executable. This beats the whole | |
2504 | purpose of explicitly starting an old executable. | |
2505 | .IP "\(bu" 4 | |
2506 | A new executable loads an extension compiled for the old executable | |
2507 | when an old perl executable is running. In this case the extension | |
2508 | will not pick up the forwarder \- with fatal results. | |
2509 | .PP | |
2510 | With support for \f(CW\*(C`LIBPATHSTRICT\*(C'\fR this may be circumvented \- unless | |
2511 | one of DLLs is started from \fI.\fR from \f(CW\*(C`LIBPATH\*(C'\fR (I do not know | |
2512 | whether \f(CW\*(C`LIBPATHSTRICT\*(C'\fR affects this case). | |
2513 | .PP | |
2514 | \&\fB\s-1REMARK\s0\fR. Unless newer kernels allow \fI.\fR in \f(CW\*(C`BEGINLIBPATH\*(C'\fR (older | |
2515 | do not), this mess cannot be completely cleaned. (It turns out that | |
2516 | as of the beginning of 2002, \fI.\fR is not allowed, but \fI.\e.\fR is \- and | |
2517 | it has the same effect.) | |
2518 | .PP | |
2519 | \&\fB\s-1REMARK\s0\fR. \f(CW\*(C`LIBPATHSTRICT\*(C'\fR, \f(CW\*(C`BEGINLIBPATH\*(C'\fR and \f(CW\*(C`ENDLIBPATH\*(C'\fR are | |
2520 | not environment variables, although \fIcmd.exe\fR emulates them on \f(CW\*(C`SET | |
2521 | \&...\*(C'\fR lines. From Perl they may be accessed by Cwd::extLibpath and | |
2522 | Cwd::extLibpath_set. | |
2523 | .Sh "\s-1DLL\s0 forwarder generation" | |
2524 | .IX Subsection "DLL forwarder generation" | |
2525 | Assume that the old \s-1DLL\s0 is named \fIperlE0AC.dll\fR (as is one for | |
2526 | 5.005_53), and the new version is 5.6.1. Create a file | |
2527 | \&\fIperl5shim.def\-leader\fR with | |
2528 | .PP | |
2529 | .Vb 5 | |
2530 | \& LIBRARY 'perlE0AC' INITINSTANCE TERMINSTANCE | |
2531 | \& DESCRIPTION '@#perl5-porters@perl.org:5.006001#@ Perl module for 5.00553 -> Perl 5.6.1 forwarder' | |
2532 | \& CODE LOADONCALL | |
2533 | \& DATA LOADONCALL NONSHARED MULTIPLE | |
2534 | \& EXPORTS | |
2535 | .Ve | |
2536 | .PP | |
2537 | modifying the versions/names as needed. Run | |
2538 | .PP | |
2539 | .Vb 1 | |
2540 | \& perl -wnle "next if 0../EXPORTS/; print qq( \e"$1\e") if /\e"(\ew+)\e"/" perl5.def >lst | |
2541 | .Ve | |
2542 | .PP | |
2543 | in the Perl build directory (to make the \s-1DLL\s0 smaller replace perl5.def | |
2544 | with the definition file for the older version of Perl if present). | |
2545 | .PP | |
2546 | .Vb 2 | |
2547 | \& cat perl5shim.def-leader lst >perl5shim.def | |
2548 | \& gcc -Zomf -Zdll -o perlE0AC.dll perl5shim.def -s -llibperl | |
2549 | .Ve | |
2550 | .PP | |
2551 | (ignore multiple \f(CW\*(C`warning L4085\*(C'\fR). | |
2552 | .Sh "Threading" | |
2553 | .IX Subsection "Threading" | |
2554 | As of release 5.003_01 perl is linked to multithreaded C \s-1RTL\s0 | |
2555 | \&\s-1DLL\s0. If perl itself is not compiled multithread\-enabled, so will not be perl's | |
2556 | \&\fImalloc()\fR. However, extensions may use multiple thread on their own | |
2557 | risk. | |
2558 | .PP | |
2559 | This was needed to compile \f(CW\*(C`Perl/Tk\*(C'\fR for XFree86\-OS/2 out\-of\-the\-box, and | |
2560 | link with DLLs for other useful libraries, which typically are compiled | |
2561 | with \f(CW\*(C`\-Zmt \-Zcrtdll\*(C'\fR. | |
2562 | .Sh "Calls to external programs" | |
2563 | .IX Subsection "Calls to external programs" | |
2564 | Due to a popular demand the perl external program calling has been | |
2565 | changed wrt Andreas Kaiser's port. \fIIf\fR perl needs to call an | |
2566 | external program \fIvia shell\fR, the \fIf:/bin/sh.exe\fR will be called, or | |
2567 | whatever is the override, see \*(L"\s-1PERL_SH_DIR\s0\*(R". | |
2568 | .PP | |
2569 | Thus means that you need to get some copy of a \fIsh.exe\fR as well (I | |
2570 | use one from pdksh). The path \fIF:/bin\fR above is set up automatically during | |
2571 | the build to a correct value on the builder machine, but is | |
2572 | overridable at runtime, | |
2573 | .PP | |
2574 | \&\fBReasons:\fR a consensus on \f(CW\*(C`perl5\-porters\*(C'\fR was that perl should use | |
2575 | one non-overridable shell per platform. The obvious choices for \s-1OS/2\s0 | |
2576 | are \fIcmd.exe\fR and \fIsh.exe\fR. Having perl build itself would be impossible | |
2577 | with \fIcmd.exe\fR as a shell, thus I picked up \f(CW\*(C`sh.exe\*(C'\fR. This assures almost | |
2578 | 100% compatibility with the scripts coming from *nix. As an added benefit | |
2579 | this works as well under \s-1DOS\s0 if you use DOS-enabled port of pdksh | |
2580 | (see \*(L"Prerequisites\*(R"). | |
2581 | .PP | |
2582 | \&\fBDisadvantages:\fR currently \fIsh.exe\fR of pdksh calls external programs | |
2583 | via \fIfork()\fR/\fIexec()\fR, and there is \fIno\fR functioning \fIexec()\fR on | |
2584 | \&\s-1OS/2\s0. \fIexec()\fR is emulated by \s-1EMX\s0 by an asynchronous call while the caller | |
2585 | waits for child completion (to pretend that the \f(CW\*(C`pid\*(C'\fR did not change). This | |
2586 | means that 1 \fIextra\fR copy of \fIsh.exe\fR is made active via \fIfork()\fR/\fIexec()\fR, | |
2587 | which may lead to some resources taken from the system (even if we do | |
2588 | not count extra work needed for \fIfork()\fRing). | |
2589 | .PP | |
2590 | Note that this a lesser issue now when we do not spawn \fIsh.exe\fR | |
2591 | unless needed (metachars found). | |
2592 | .PP | |
2593 | One can always start \fIcmd.exe\fR explicitly via | |
2594 | .PP | |
2595 | .Vb 1 | |
2596 | \& system 'cmd', '/c', 'mycmd', 'arg1', 'arg2', ... | |
2597 | .Ve | |
2598 | .PP | |
2599 | If you need to use \fIcmd.exe\fR, and do not want to hand-edit thousands of your | |
2600 | scripts, the long-term solution proposed on p5\-p is to have a directive | |
2601 | .PP | |
2602 | .Vb 1 | |
2603 | \& use OS2::Cmd; | |
2604 | .Ve | |
2605 | .PP | |
2606 | which will override \fIsystem()\fR, \fIexec()\fR, \f(CW``\fR, and | |
2607 | \&\f(CW\*(C`open(,'...|')\*(C'\fR. With current perl you may override only \fIsystem()\fR, | |
2608 | \&\fIreadpipe()\fR \- the explicit version of \f(CW``\fR, and maybe \fIexec()\fR. The code | |
2609 | will substitute the one-argument call to \fIsystem()\fR by | |
2610 | \&\f(CW\*(C`CORE::system('cmd.exe', '/c', shift)\*(C'\fR. | |
2611 | .PP | |
2612 | If you have some working code for \f(CW\*(C`OS2::Cmd\*(C'\fR, please send it to me, | |
2613 | I will include it into distribution. I have no need for such a module, so | |
2614 | cannot test it. | |
2615 | .PP | |
2616 | For the details of the current situation with calling external programs, | |
2617 | see \*(L"2 (and \s-1DOS\s0) programs under Perl\*(R" in Starting \s-1OS\s0. Set us mention a couple | |
2618 | of features: | |
2619 | .IP "\(bu" 4 | |
2620 | External scripts may be called by their basename. Perl will try the same | |
2621 | extensions as when processing \fB\-S\fR command-line switch. | |
2622 | .IP "\(bu" 4 | |
2623 | External scripts starting with \f(CW\*(C`#!\*(C'\fR or \f(CW\*(C`extproc \*(C'\fR will be executed directly, | |
2624 | without calling the shell, by calling the program specified on the rest of | |
2625 | the first line. | |
2626 | .Sh "Memory allocation" | |
2627 | .IX Subsection "Memory allocation" | |
2628 | Perl uses its own \fImalloc()\fR under \s-1OS/2\s0 \- interpreters are usually malloc-bound | |
2629 | for speed, but perl is not, since its malloc is lightning\-fast. | |
2630 | Perl-memory-usage-tuned benchmarks show that Perl's malloc is 5 times quicker | |
2631 | than \s-1EMX\s0 one. I do not have convincing data about memory footprint, but | |
2632 | a (pretty random) benchmark showed that Perl's one is 5% better. | |
2633 | .PP | |
2634 | Combination of perl's \fImalloc()\fR and rigid \s-1DLL\s0 name resolution creates | |
2635 | a special problem with library functions which expect their return value to | |
2636 | be \fIfree()\fRd by system's \fIfree()\fR. To facilitate extensions which need to call | |
2637 | such functions, system memory-allocation functions are still available with | |
2638 | the prefix \f(CW\*(C`emx_\*(C'\fR added. (Currently only \s-1DLL\s0 perl has this, it should | |
2639 | propagate to \fIperl_.exe\fR shortly.) | |
2640 | .Sh "Threads" | |
2641 | .IX Subsection "Threads" | |
2642 | One can build perl with thread support enabled by providing \f(CW\*(C`\-D usethreads\*(C'\fR | |
2643 | option to \fIConfigure\fR. Currently \s-1OS/2\s0 support of threads is very | |
2644 | preliminary. | |
2645 | .PP | |
2646 | Most notable problems: | |
2647 | .ie n .IP """COND_WAIT""" 4 | |
2648 | .el .IP "\f(CWCOND_WAIT\fR" 4 | |
2649 | .IX Item "COND_WAIT" | |
2650 | may have a race condition (but probably does not due to edge-triggered | |
2651 | nature of \s-1OS/2\s0 Event semaphores). (Needs a reimplementation (in terms of chaining | |
2652 | waiting threads, with the linked list stored in per-thread structure?)?) | |
2653 | .IP "\fIos2.c\fR" 4 | |
2654 | .IX Item "os2.c" | |
2655 | has a couple of static variables used in OS/2\-specific functions. (Need to be | |
2656 | moved to per-thread structure, or serialized?) | |
2657 | .PP | |
2658 | Note that these problems should not discourage experimenting, since they | |
2659 | have a low probability of affecting small programs. | |
2660 | .SH "BUGS" | |
2661 | .IX Header "BUGS" | |
2662 | This description is not updated often (since 5.6.1?), see \fI./os2/Changes\fR | |
2663 | (perlos2delta) for more info. | |
2664 | .SH "AUTHOR" | |
2665 | .IX Header "AUTHOR" | |
2666 | Ilya Zakharevich, cpan@ilyaz.org | |
2667 | .SH "SEE ALSO" | |
2668 | .IX Header "SEE ALSO" | |
2669 | \&\fIperl\fR\|(1). |