1 If you read this file _as_is_, just ignore the funny characters you
2 see. It is written in the POD format (see perlpod manpage) which is
3 specially designed to be readable as is.
7 perlos2 - Perl under OS/2, DOS, Win0.3*, Win0.95 and WinNT.
11 One can read this document in the following formats:
18 to list some (not all may be available simultaneously), or it may
19 be read I<as is>: either as F<README.os2>, or F<pod/perlos2.pod>.
21 To read the F<.INF> version of documentation (B<very> recommended)
22 outside of OS/2, one needs an IBM's reader (may be available on IBM
23 ftp sites (?) (URL anyone?)) or shipped with PC DOS 7.0 and IBM's
26 A copy of a Win* viewer is contained in the "Just add OS/2 Warp" package
28 ftp://ftp.software.ibm.com/ps/products/os2/tools/jaow/jaow.zip
30 in F<?:\JUST_ADD\view.exe>. This gives one an access to EMX's
31 F<.INF> docs as well (text form is available in F</emx/doc> in
34 Note that if you have F<lynx.exe> installed, you can follow WWW links
35 from this document in F<.INF> format. If you have EMX docs installed
36 correctly, you can follow library links (you need to have C<view emxbook>
37 working by setting C<EMXBOOK> environment variable as it is described
44 perlos2 - Perl under OS/2, DOS, Win0.3*, Win0.95 and WinNT.
52 - Starting Perl programs under OS/2 (and DOS and...)
53 - Starting OS/2 (and DOS) programs under Perl
54 Frequently asked questions
55 - I cannot run external programs
56 - I cannot embed perl into my program, or use perl.dll from my program.
57 - `` and pipe-open do not work under DOS.
58 - Cannot start find.exe "pattern" file
60 - Automatic binary installation
61 - Manual binary installation
63 Accessing documentation
74 - Application of the patches
78 - Installing the built perl
81 - Some / became \ in pdksh.
82 - 'errno' - unresolved external
84 - Some problem (forget which ;-)
85 - Library ... not found
87 Specific (mis)features of EMX port
88 - setpriority, getpriority
90 - extproc on the first line
101 - Why dynamic linking?
113 - Calls to external programs
122 The target is to make OS/2 the best supported platform for
123 using/building/developing Perl and I<Perl applications>, as well as
124 make Perl the best language to use under OS/2. The secondary target is
125 to try to make this work under DOS and Win* as well (but not B<too> hard).
127 The current state is quite close to this target. Known limitations:
133 Some *nix programs use fork() a lot, but currently fork() is not
134 supported after I<use>ing dynamically loaded extensions.
138 You need a separate perl executable F<perl__.exe> (see L<perl__.exe>)
139 to use PM code in your application (like the forthcoming Perl/Tk).
143 There is no simple way to access WPS objects. The only way I know
144 is via C<OS2::REXX> extension (see L<OS2::REXX>), and we do not have access to
145 convenience methods of Object-REXX. (Is it possible at all? I know
146 of no Object-REXX API.)
150 Please keep this list up-to-date by informing me about other items.
154 Since OS/2 port of perl uses a remarkable EMX environment, it can
155 run (and build extensions, and - possibly - be build itself) under any
156 environment which can run EMX. The current list is DOS,
157 DOS-inside-OS/2, Win0.3*, Win0.95 and WinNT. Out of many perl flavors,
158 only one works, see L<"perl_.exe">.
160 Note that not all features of Perl are available under these
161 environments. This depends on the features the I<extender> - most
162 probably RSX - decided to implement.
164 Cf. L<Prerequisites>.
172 EMX runtime is required (may be substituted by RSX). Note that
173 it is possible to make F<perl_.exe> to run under DOS without any
174 external support by binding F<emx.exe>/F<rsx.exe> to it, see L<emxbind>. Note
175 that under DOS for best results one should use RSX runtime, which
176 has much more functions working (like C<fork>, C<popen> and so on). In
177 fact RSX is required if there is no VCPI present. Note the
180 Only the latest runtime is supported, currently C<0.9c>. Perl may run
181 under earlier versions of EMX, but this is not tested.
183 One can get different parts of EMX from, say
185 ftp://ftp.cdrom.com/pub/os2/emx09c/
186 ftp://hobbes.nmsu.edu/os2/unix/emx09c/
188 The runtime component should have the name F<emxrt.zip>.
190 B<NOTE>. It is enough to have F<emx.exe>/F<rsx.exe> on your path. One
191 does not need to specify them explicitly (though this
199 To run Perl on DPMI platforms one needs RSX runtime. This is
200 needed under DOS-inside-OS/2, Win0.3*, Win0.95 and WinNT (see
201 L<"Other OSes">). RSX would not work with VCPI
202 only, as EMX would, it requires DMPI.
204 Having RSX and the latest F<sh.exe> one gets a fully functional
205 B<*nix>-ish environment under DOS, say, C<fork>, C<``> and
206 pipe-C<open> work. In fact, MakeMaker works (for static build), so one
207 can have Perl development environment under DOS.
209 One can get RSX from, say
211 ftp://ftp.cdrom.com/pub/os2/emx09c/contrib
212 ftp://ftp.uni-bielefeld.de/pub/systems/msdos/misc
213 ftp://ftp.leo.org/pub/comp/os/os2/leo/devtools/emx+gcc/contrib
215 Contact the author on C<rainer@mathematik.uni-bielefeld.de>.
217 The latest F<sh.exe> with DOS hooks is available at
219 ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/sh_dos.zip
223 Perl does not care about file systems, but to install the whole perl
224 library intact one needs a file system which supports long file names.
226 Note that if you do not plan to build the perl itself, it may be
227 possible to fool EMX to truncate file names. This is not supported,
228 read EMX docs to see how to do it.
232 To start external programs with complicated command lines (like with
233 pipes in between, and/or quoting of arguments), Perl uses an external
234 shell. With EMX port such shell should be named <sh.exe>, and located
235 either in the wired-in-during-compile locations (usually F<F:/bin>),
236 or in configurable location (see L<"PERL_SH_DIR">).
238 For best results use EMX pdksh. The soon-to-be-available standard
239 binary (5.2.12?) runs under DOS (with L<RSX>) as well, meanwhile use
242 ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/sh_dos.zip
246 =head2 Starting Perl programs under OS/2 (and DOS and...)
248 Start your Perl program F<foo.pl> with arguments C<arg1 arg2 arg3> the
249 same way as on any other platform, by
251 perl foo.pl arg1 arg2 arg3
253 If you want to specify perl options C<-my_opts> to the perl itself (as
254 opposed to to your program), use
256 perl -my_opts foo.pl arg1 arg2 arg3
258 Alternately, if you use OS/2-ish shell, like CMD or 4os2, put
259 the following at the start of your perl script:
261 extproc perl -S -my_opts
263 rename your program to F<foo.cmd>, and start it by typing
267 Note that because of stupid OS/2 limitations the full path of the perl
268 script is not available when you use C<extproc>, thus you are forced to
269 use C<-S> perl switch, and your script should be on path. As a plus
270 side, if you know a full path to your script, you may still start it
273 perl ../../blah/foo.cmd arg1 arg2 arg3
275 (note that the argument C<-my_opts> is taken care of by the C<extproc> line
276 in your script, see L<C<extproc> on the first line>).
278 To understand what the above I<magic> does, read perl docs about C<-S>
279 switch - see L<perlrun>, and cmdref about C<extproc>:
286 or whatever method you prefer.
288 There are also endless possibilities to use I<executable extensions> of
289 4os2, I<associations> of WPS and so on... However, if you use
290 *nixish shell (like F<sh.exe> supplied in the binary distribution),
291 you need to follow the syntax specified in L<perlrun/"Switches">.
293 Note that B<-S> switch enables a search with additional extensions
294 F<.cmd>, F<.btm>, F<.bat>, F<.pl> as well.
296 =head2 Starting OS/2 (and DOS) programs under Perl
298 This is what system() (see L<perlfunc/system>), C<``> (see
299 L<perlop/"I/O Operators">), and I<open pipe> (see L<perlfunc/open>)
300 are for. (Avoid exec() (see L<perlfunc/exec>) unless you know what you
303 Note however that to use some of these operators you need to have a
304 sh-syntax shell installed (see L<"Pdksh">,
305 L<"Frequently asked questions">), and perl should be able to find it
306 (see L<"PERL_SH_DIR">).
308 The only cases when the shell is not used is the multi-argument
309 system() (see L<perlfunc/system>)/exec() (see L<perlfunc/exec>), and
310 one-argument version thereof without redirection and shell
313 =head1 Frequently asked questions
315 =head2 I cannot run external programs
321 Did you run your programs with C<-w> switch? See
322 L<Starting OS/2 (and DOS) programs under Perl>.
326 Do you try to run I<internal> shell commands, like C<`copy a b`>
327 (internal for F<cmd.exe>), or C<`glob a*b`> (internal for ksh)? You
328 need to specify your shell explicitly, like C<`cmd /c copy a b`>,
329 since Perl cannot deduce which commands are internal to your shell.
333 =head2 I cannot embed perl into my program, or use F<perl.dll> from my
338 =item Is your program EMX-compiled with C<-Zmt -Zcrtdll>?
340 If not, you need to build a stand-alone DLL for perl. Contact me, I
341 did it once. Sockets would not work, as a lot of other stuff.
343 =item Did you use L<ExtUtils::Embed>?
345 I had reports it does not work. Somebody would need to fix it.
349 =head2 C<``> and pipe-C<open> do not work under DOS.
351 This may a variant of just L<"I cannot run external programs">, or a
352 deeper problem. Basically: you I<need> RSX (see L<"Prerequisites">)
353 for these commands to work, and you may need a port of F<sh.exe> which
354 understands command arguments. One of such ports is listed in
355 L<"Prerequisites"> under RSX. Do not forget to set variable
356 C<L<"PERL_SH_DIR">> as well.
358 DPMI is required for RSX.
360 =head2 Cannot start C<find.exe "pattern" file>
364 system 'cmd', '/c', 'find "pattern" file';
365 `cmd /c 'find "pattern" file'`
367 This would start F<find.exe> via F<cmd.exe> via C<sh.exe> via
368 C<perl.exe>, but this is a price to pay if you want to use
369 non-conforming program. In fact F<find.exe> cannot be started at all
370 using C library API only. Otherwise the following command-lines were
378 =head2 Automatic binary installation
380 The most convenient way of installing perl is via perl installer
381 F<install.exe>. Just follow the instructions, and 99% of the
382 installation blues would go away.
384 Note however, that you need to have F<unzip.exe> on your path, and
385 EMX environment I<running>. The latter means that if you just
386 installed EMX, and made all the needed changes to F<Config.sys>,
387 you may need to reboot in between. Check EMX runtime by running
391 A folder is created on your desktop which contains some useful
394 B<Things not taken care of by automatic binary installation:>
398 =item C<PERL_BADLANG>
400 may be needed if you change your codepage I<after> perl installation,
401 and the new value is not supported by EMX. See L<"PERL_BADLANG">.
403 =item C<PERL_BADFREE>
405 see L<"PERL_BADFREE">.
409 This file resides somewhere deep in the location you installed your
410 perl library, find it out by
412 perl -MConfig -le "print $INC{'Config.pm'}"
414 While most important values in this file I<are> updated by the binary
415 installer, some of them may need to be hand-edited. I know no such
416 data, please keep me informed if you find one.
420 B<NOTE>. Because of a typo the binary installer of 5.00305
421 would install a variable C<PERL_SHPATH> into F<Config.sys>. Please
422 remove this variable and put C<L<PERL_SH_DIR>> instead.
424 =head2 Manual binary installation
426 As of version 5.00305, OS/2 perl binary distribution comes split
427 into 11 components. Unfortunately, to enable configurable binary
428 installation, the file paths in the zip files are not absolute, but
429 relative to some directory.
431 Note that the extraction with the stored paths is still necessary
432 (default with unzip, specify C<-d> to pkunzip). However, you
433 need to know where to extract the files. You need also to manually
434 change entries in F<Config.sys> to reflect where did you put the
435 files. Note that if you have some primitive unzipper (like
436 pkunzip), you may get a lot of warnings/errors during
437 unzipping. Upgrade to C<(w)unzip>.
439 Below is the sample of what to do to reproduce the configuration on my
444 =item Perl VIO and PM executables (dynamically linked)
446 unzip perl_exc.zip *.exe *.ico -d f:/emx.add/bin
447 unzip perl_exc.zip *.dll -d f:/emx.add/dll
449 (have the directories with C<*.exe> on PATH, and C<*.dll> on
452 =item Perl_ VIO executable (statically linked)
454 unzip perl_aou.zip -d f:/emx.add/bin
456 (have the directory on PATH);
458 =item Executables for Perl utilities
460 unzip perl_utl.zip -d f:/emx.add/bin
462 (have the directory on PATH);
464 =item Main Perl library
466 unzip perl_mlb.zip -d f:/perllib/lib
468 If this directory is preserved, you do not need to change
469 anything. However, for perl to find it if it is changed, you need to
470 C<set PERLLIB_PREFIX> in F<Config.sys>, see L<"PERLLIB_PREFIX">.
472 =item Additional Perl modules
474 unzip perl_ste.zip -d f:/perllib/lib/site_perl
476 If you do not change this directory, do nothing. Otherwise put this
477 directory and subdirectory F<./os2> in C<PERLLIB> or C<PERL5LIB>
478 variable. Do not use C<PERL5LIB> unless you have it set already. See
479 L<perl/"ENVIRONMENT">.
481 =item Tools to compile Perl modules
483 unzip perl_blb.zip -d f:/perllib/lib
485 If this directory is preserved, you do not need to change
486 anything. However, for perl to find it if it is changed, you need to
487 C<set PERLLIB_PREFIX> in F<Config.sys>, see L<"PERLLIB_PREFIX">.
489 =item Manpages for Perl and utilities
491 unzip perl_man.zip -d f:/perllib/man
493 This directory should better be on C<MANPATH>. You need to have a
494 working man to access these files.
496 =item Manpages for Perl modules
498 unzip perl_mam.zip -d f:/perllib/man
500 This directory should better be on C<MANPATH>. You need to have a
501 working man to access these files.
503 =item Source for Perl documentation
505 unzip perl_pod.zip -d f:/perllib/lib
507 This is used by by C<perldoc> program (see L<perldoc>), and may be used to
508 generate HTML documentation usable by WWW browsers, and
509 documentation in zillions of other formats: C<info>, C<LaTeX>,
510 C<Acrobat>, C<FrameMaker> and so on.
512 =item Perl manual in F<.INF> format
514 unzip perl_inf.zip -d d:/os2/book
516 This directory should better be on C<BOOKSHELF>.
520 unzip perl_sh.zip -d f:/bin
522 This is used by perl to run external commands which explicitly
523 require shell, like the commands using I<redirection> and I<shell
524 metacharacters>. It is also used instead of explicit F</bin/sh>.
526 Set C<PERL_SH_DIR> (see L<"PERL_SH_DIR">) if you move F<sh.exe> from
529 B<Note.> It may be possible to use some other sh-compatible shell
534 After you installed the components you needed and updated the
535 F<Config.sys> correspondingly, you need to hand-edit
536 F<Config.pm>. This file resides somewhere deep in the location you
537 installed your perl library, find it out by
539 perl -MConfig -le "print $INC{'Config.pm'}"
541 You need to correct all the entries which look like file paths (they
542 currently start with C<f:/>).
546 The automatic and manual perl installation leave precompiled paths
547 inside perl executables. While these paths are overwriteable (see
548 L<"PERLLIB_PREFIX">, L<"PERL_SH_DIR">), one may get better results by
549 binary editing of paths inside the executables/DLLs.
551 =head1 Accessing documentation
553 Depending on how you built/installed perl you may have (otherwise
554 identical) Perl documentation in the following formats:
556 =head2 OS/2 F<.INF> file
558 Most probably the most convenient form. Under OS/2 view it as
563 view perl ExtUtils::MakeMaker
565 (currently the last two may hit a wrong location, but this may improve
566 soon). Under Win* see L<"SYNOPSIS">.
568 If you want to build the docs yourself, and have I<OS/2 toolkit>, run
572 in F</perllib/lib/pod> directory, then
576 (Expect a lot of errors during the both steps.) Now move it on your
581 If you have perl documentation in the source form, perl utilities
582 installed, and GNU groff installed, you may use
586 perldoc ExtUtils::MakeMaker
588 to access the perl documentation in the text form (note that you may get
589 better results using perl manpages).
591 Alternately, try running pod2text on F<.pod> files.
595 If you have man installed on your system, and you installed perl
596 manpages, use something like this:
600 man ExtUtils.MakeMaker
602 to access documentation for different components of Perl. Start with
606 Note that dot (F<.>) is used as a package separator for documentation
607 for packages, and as usual, sometimes you need to give the section - C<3>
608 above - to avoid shadowing by the I<less(1) manpage>.
610 Make sure that the directory B<above> the directory with manpages is
611 on our C<MANPATH>, like this
613 set MANPATH=c:/man;f:/perllib/man
617 If you have some WWW browser available, installed the Perl
618 documentation in the source form, and Perl utilities, you can build
619 HTML docs. Cd to directory with F<.pod> files, and do like this
621 cd f:/perllib/lib/pod
624 After this you can direct your browser the file F<perl.html> in this
625 directory, and go ahead with reading docs, like this:
627 explore file:///f:/perllib/lib/pod/perl.html
629 Alternatively you may be able to get these docs prebuilt from CPAN.
631 =head2 GNU C<info> files
633 Users of Emacs would appreciate it very much, especially with
634 C<CPerl> mode loaded. You need to get latest C<pod2info> from C<CPAN>,
635 or, alternately, prebuilt info pages.
639 for C<Acrobat> are available on CPAN (for slightly old version of
644 can be constructed using C<pod2latex>.
648 Here we discuss how to build Perl under OS/2. There is an alternative
649 (but maybe older) view on L<http://www.shadow.net/~troc/os2perl.html>.
653 You need to have the latest EMX development environment, the full
654 GNU tool suite (gawk renamed to awk, and GNU F<find.exe>
655 earlier on path than the OS/2 F<find.exe>, same with F<sort.exe>, to
661 ). You need the latest version of F<pdksh> installed as F<sh.exe>.
663 Possible locations to get this from are
665 ftp://hobbes.nmsu.edu/os2/unix/
666 ftp://ftp.cdrom.com/pub/os2/unix/
667 ftp://ftp.cdrom.com/pub/os2/dev32/
668 ftp://ftp.cdrom.com/pub/os2/emx09c/
670 It is reported that the following archives contain enough utils to
671 build perl: gnufutil.zip, gnusutil.zip, gnututil.zip, gnused.zip,
672 gnupatch.zip, gnuawk.zip, gnumake.zip and ksh527rt.zip. Note that
673 all these utilities are known to be available from LEO:
675 ftp://ftp.leo.org/pub/comp/os/os2/leo/gnu
677 Make sure that no copies or perl are currently running. Later steps
678 of the build may fail since an older version of perl.dll loaded into
681 Also make sure that you have F</tmp> directory on the current drive,
682 and F<.> directory in your C<LIBPATH>. One may try to correct the
687 if you use something like F<CMD.EXE> or latest versions of F<4os2.exe>.
689 Make sure your gcc is good for C<-Zomf> linking: run C<omflibs>
690 script in F</emx/lib> directory.
692 Check that you have link386 installed. It comes standard with OS/2,
693 but may be not installed due to customization. If typing
697 shows you do not have it, do I<Selective install>, and choose C<Link
698 object modules> in I<Optional system utilities/More>. If you get into
699 link386, press C<Ctrl-C>.
701 =head2 Getting perl source
703 You need to fetch the latest perl source (including developers
704 releases). With some probability it is located in
706 http://www.perl.com/CPAN/src/5.0
707 http://www.perl.com/CPAN/src/5.0/unsupported
709 If not, you may need to dig in the indices to find it in the directory
710 of the current maintainer.
712 Quick cycle of developers release may break the OS/2 build time to
715 http://www.perl.com/CPAN/ports/os2/ilyaz/
717 may indicate the latest release which was publicly released by the
718 maintainer. Note that the release may include some additional patches
719 to apply to the current source of perl.
723 tar vzxf perl5.00409.tar.gz
725 You may see a message about errors while extracting F<Configure>. This is
726 because there is a conflict with a similarly-named file F<configure>.
728 Change to the directory of extraction.
730 =head2 Application of the patches
732 You need to apply the patches in F<./os2/diff.*> and
733 F<./os2/POSIX.mkfifo> like this:
735 gnupatch -p0 < os2\POSIX.mkfifo
736 gnupatch -p0 < os2\diff.configure
738 You may also need to apply the patches supplied with the binary
739 distribution of perl.
741 Note also that the F<db.lib> and F<db.a> from the EMX distribution
742 are not suitable for multi-threaded compile (note that currently perl
743 is not multithread-safe, but is compiled as multithreaded for
744 compatibility with XFree86-OS/2). Get a corrected one from
746 ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2/db_mt.zip
750 You may look into the file F<./hints/os2.sh> and correct anything
751 wrong you find there. I do not expect it is needed anywhere.
755 sh Configure -des -D prefix=f:/perllib
757 C<prefix> means: where to install the resulting perl library. Giving
758 correct prefix you may avoid the need to specify C<PERLLIB_PREFIX>,
759 see L<"PERLLIB_PREFIX">.
761 I<Ignore the message about missing C<ln>, and about C<-c> option to
762 tr>. In fact if you can trace where the latter spurious warning
763 comes from, please inform me.
769 At some moment the built may die, reporting a I<version mismatch> or
770 I<unable to run F<perl>>. This means that most of the build has been
771 finished, and it is the time to move the constructed F<perl.dll> to
772 some I<absolute> location in LIBPATH. After this is done the build
773 should finish without a lot of fuss. I<One can avoid the interruption
774 if one has the correct prebuilt version of F<perl.dll> on LIBPATH, but
775 probably this is not needed anymore, since F<miniperl.exe> is linked
778 Warnings which are safe to ignore: I<mkfifo() redefined> inside
787 Some tests (4..6) should fail. Some perl invocations should end in a
788 segfault (system error C<SYS3175>). To get finer error reports,
793 The report you get may look like
795 Failed Test Status Wstat Total Fail Failed List of failed
796 ---------------------------------------------------------------
797 io/fs.t 26 11 42.31% 2-5, 7-11, 18, 25
798 lib/io_pipe.t 3 768 6 ?? % ??
799 lib/io_sock.t 3 768 5 ?? % ??
800 op/stat.t 56 5 8.93% 3-4, 20, 35, 39
801 Failed 4/140 test scripts, 97.14% okay. 27/2937 subtests failed, 99.08% okay.
803 Note that using `make test' target two more tests may fail: C<op/exec:1>
804 because of (mis)feature of pdksh, and C<lib/posix:15>, which checks
805 that the buffers are not flushed on C<_exit> (this is a bug in the test
806 which assumes that tty output is buffered).
808 I submitted a patch to EMX which makes it possible to fork() with EMX
809 dynamic libraries loaded, which makes F<lib/io*> tests pass. This means
810 that soon the number of failing tests may decrease yet more.
812 However, the test F<lib/io_udp.t> is disabled, since it never terminates, I
813 do not know why. Comments/fixes welcome.
815 The reasons for failed tests are:
821 Checks I<file system> operations. Tests:
827 Check C<link()> and C<inode count> - nonesuch under OS/2.
831 Checks C<atime> and C<mtime> of C<stat()> - I could not understand this test.
835 Checks C<truncate()> on a filehandle just opened for write - I do not
836 know why this should or should not work.
840 =item F<lib/io_pipe.t>
842 Checks C<IO::Pipe> module. Some feature of EMX - test fork()s with
843 dynamic extension loaded - unsupported now.
845 =item F<lib/io_sock.t>
847 Checks C<IO::Socket> module. Some feature of EMX - test fork()s
848 with dynamic extension loaded - unsupported now.
852 Checks C<stat()>. Tests:
858 Checks C<inode count> - nonesuch under OS/2.
862 Checks C<mtime> and C<ctime> of C<stat()> - I could not understand this test.
866 Checks C<-x> - determined by the file extension only under OS/2.
874 Checks C<-t> of F</dev/null>. Should not fail!
880 In addition to errors, you should get a lot of warnings.
884 =item A lot of `bad free'
886 in databases related to Berkeley DB. This is a confirmed bug of
887 DB. You may disable this warnings, see L<"PERL_BADFREE">.
889 =item Process terminated by SIGTERM/SIGINT
891 This is a standard message issued by OS/2 applications. *nix
892 applications die in silence. It is considered a feature. One can
893 easily disable this by appropriate sighandlers.
895 However the test engine bleeds these message to screen in unexpected
896 moments. Two messages of this kind I<should> be present during
899 =item F<*/sh.exe>: ln: not found
901 =item C<ls>: /dev: No such file or directory
903 The last two should be self-explanatory. The test suite discovers that
904 the system it runs on is not I<that much> *nixish.
908 A lot of `bad free'... in databases, bug in DB confirmed on other
909 platforms. You may disable it by setting PERL_BADFREE environment variable
912 =head2 Installing the built perl
918 It would put the generated files into needed locations. Manually put
919 F<perl.exe>, F<perl__.exe> and F<perl___.exe> to a location on your
920 PATH, F<perl.dll> to a location on your LIBPATH.
924 make cmdscripts INSTALLCMDDIR=d:/ir/on/path
926 to convert perl utilities to F<.cmd> files and put them on
927 PATH. You need to put F<.EXE>-utilities on path manually. They are
928 installed in C<$prefix/bin>, here C<$prefix> is what you gave to
929 F<Configure>, see L<Making>.
931 =head2 C<a.out>-style build
933 Proceed as above, but make F<perl_.exe> (see L<"perl_.exe">) by
942 Manually put F<perl_.exe> to a location on your PATH.
944 Since C<perl_> has the extensions prebuilt, it does not suffer from
945 the I<dynamic extensions + fork()> syndrome, thus the failing tests
948 Failed Test Status Wstat Total Fail Failed List of failed
949 ---------------------------------------------------------------
950 io/fs.t 26 11 42.31% 2-5, 7-11, 18, 25
951 op/stat.t 56 5 8.93% 3-4, 20, 35, 39
952 Failed 2/118 test scripts, 98.31% okay. 16/2445 subtests failed, 99.35% okay.
954 B<Note.> The build process for C<perl_> I<does not know> about all the
955 dependencies, so you should make sure that anything is up-to-date,
964 =head2 Some C</> became C<\> in pdksh.
966 You have a very old pdksh. See L<Prerequisites>.
968 =head2 C<'errno'> - unresolved external
970 You do not have MT-safe F<db.lib>. See L<Prerequisites>.
972 =head2 Problems with tr
974 reported with very old version of tr.
976 =head2 Some problem (forget which ;-)
978 You have an older version of F<perl.dll> on your LIBPATH, which
979 broke the build of extensions.
981 =head2 Library ... not found
983 You did not run C<omflibs>. See L<Prerequisites>.
985 =head2 Segfault in make
987 You use an old version of GNU make. See L<Prerequisites>.
989 =head1 Specific (mis)features of OS/2 port
991 =head2 C<setpriority>, C<getpriority>
993 Note that these functions are compatible with *nix, not with the older
994 ports of '94 - 95. The priorities are absolute, go from 32 to -95,
995 lower is quicker. 0 is the default priority.
999 Multi-argument form of C<system()> allows an additional numeric
1000 argument. The meaning of this argument is described in
1003 =head2 C<extproc> on the first line
1005 If the first chars of a script are C<"extproc ">, this line is treated
1006 as C<#!>-line, thus all the switches on this line are processed (twice
1007 if script was started via cmd.exe).
1009 =head2 Additional modules:
1011 L<OS2::Process>, L<OS2::REXX>, L<OS2::PrfDB>, L<OS2::ExtAttr>. This
1012 modules provide access to additional numeric argument for C<system>,
1013 to DLLs having functions with REXX signature and to REXX runtime, to
1014 OS/2 databases in the F<.INI> format, and to Extended Attributes.
1016 Two additional extensions by Andreas Kaiser, C<OS2::UPM>, and
1017 C<OS2::FTP>, are included into my ftp directory, mirrored on CPAN.
1019 =head2 Prebuilt methods:
1023 =item C<File::Copy::syscopy>
1025 used by C<File::Copy::copy>, see L<File::Copy>.
1027 =item C<DynaLoader::mod2fname>
1029 used by C<DynaLoader> for DLL name mangling.
1031 =item C<Cwd::current_drive()>
1035 =item C<Cwd::sys_chdir(name)>
1037 leaves drive as it is.
1039 =item C<Cwd::change_drive(name)>
1042 =item C<Cwd::sys_is_absolute(name)>
1044 means has drive letter and is_rooted.
1046 =item C<Cwd::sys_is_rooted(name)>
1048 means has leading C<[/\\]> (maybe after a drive-letter:).
1050 =item C<Cwd::sys_is_relative(name)>
1052 means changes with current dir.
1054 =item C<Cwd::sys_cwd(name)>
1056 Interface to cwd from EMX. Used by C<Cwd::cwd>.
1058 =item C<Cwd::sys_abspath(name, dir)>
1060 Really really odious function to implement. Returns absolute name of
1061 file which would have C<name> if CWD were C<dir>. C<Dir> defaults to the
1064 =item C<Cwd::extLibpath([type])
1066 Get current value of extended library search path. If C<type> is
1067 present and I<true>, works with END_LIBPATH, otherwise with
1070 =item C<Cwd::extLibpath_set( path [, type ] )>
1072 Set current value of extended library search path. If C<type> is
1073 present and I<true>, works with END_LIBPATH, otherwise with
1078 (Note that some of these may be moved to different libraries -
1088 Since L<flock(3)> is present in EMX, but is not functional, it is
1089 emulated by perl. To disable the emulations, set environment variable
1090 C<USE_PERL_FLOCK=0>.
1094 Here is the list of things which may be "broken" on
1095 EMX (from EMX docs):
1101 The functions L<recvmsg(3)>, L<sendmsg(3)>, and L<socketpair(3)> are not
1106 L<sock_init(3)> is not required and not implemented.
1110 L<flock(3)> is not yet implemented (dummy function). (Perl has a workaround.)
1114 L<kill(3)>: Special treatment of PID=0, PID=1 and PID=-1 is not implemented.
1122 waitpid() is not implemented for negative values of PID.
1126 Note that C<kill -9> does not work with the current version of EMX.
1130 Since F<sh.exe> is used for globing (see L<perlfunc/glob>), the bugs
1131 of F<sh.exe> plague perl as well.
1133 In particular, uppercase letters do not work in C<[...]>-patterns with
1138 =head2 Modifications
1140 Perl modifies some standard C library calls in the following ways:
1146 C<my_popen> uses F<sh.exe> if shell is required, cf. L<"PERL_SH_DIR">.
1150 is created using C<TMP> or C<TEMP> environment variable, via
1155 If the current directory is not writable, file is created using modified
1156 C<tmpnam>, so there may be a race condition.
1160 a dummy implementation.
1164 C<os2_stat> special-cases F</dev/tty> and F</dev/con>.
1168 Since L<flock(3)> is present in EMX, but is not functional, it is
1169 emulated by perl. To disable the emulations, set environment variable
1170 C<USE_PERL_FLOCK=0>.
1176 Because of idiosyncrasies of OS/2 one cannot have all the eggs in the
1177 same basket (though EMX environment tries hard to overcome this
1178 limitations, so the situation may somehow improve). There are 4
1179 executables for Perl provided by the distribution:
1183 The main workhorse. This is a chimera executable: it is compiled as an
1184 C<a.out>-style executable, but is linked with C<omf>-style dynamic
1185 library F<perl.dll>, and with dynamic CRT DLL. This executable is a
1188 It can load perl dynamic extensions, and it can fork(). Unfortunately,
1189 with the current version of EMX it cannot fork() with dynamic
1190 extensions loaded (may be fixed by patches to EMX).
1192 B<Note.> Keep in mind that fork() is needed to open a pipe to yourself.
1196 This is a statically linked C<a.out>-style executable. It can fork(),
1197 but cannot load dynamic Perl extensions. The supplied executable has a
1198 lot of extensions prebuilt, thus there are situations when it can
1199 perform tasks not possible using F<perl.exe>, like fork()ing when
1200 having some standard extension loaded. This executable is a VIO
1203 B<Note.> A better behaviour could be obtained from C<perl.exe> if it
1204 were statically linked with standard I<Perl extensions>, but
1205 dynamically linked with the I<Perl DLL> and CRT DLL. Then it would
1206 be able to fork() with standard extensions, I<and> would be able to
1207 dynamically load arbitrary extensions. Some changes to Makefiles and
1208 hint files should be necessary to achieve this.
1210 I<This is also the only executable with does not require OS/2.> The
1211 friends locked into C<M$> world would appreciate the fact that this
1212 executable runs under DOS, Win0.3*, Win0.95 and WinNT with an
1213 appropriate extender. See L<"Other OSes">.
1215 =head2 F<perl__.exe>
1217 This is the same executable as F<perl___.exe>, but it is a PM
1220 B<Note.> Usually STDIN, STDERR, and STDOUT of a PM
1221 application are redirected to C<nul>. However, it is possible to see
1222 them if you start C<perl__.exe> from a PM program which emulates a
1223 console window, like I<Shell mode> of Emacs or EPM. Thus it I<is
1224 possible> to use Perl debugger (see L<perldebug>) to debug your PM
1227 This flavor is required if you load extensions which use PM, like
1228 the forthcoming C<Perl/Tk>.
1230 =head2 F<perl___.exe>
1232 This is an C<omf>-style executable which is dynamically linked to
1233 F<perl.dll> and CRT DLL. I know no advantages of this executable
1234 over C<perl.exe>, but it cannot fork() at all. Well, one advantage is
1235 that the build process is not so convoluted as with C<perl.exe>.
1237 It is a VIO application.
1239 =head2 Why strange names?
1241 Since Perl processes the C<#!>-line (cf.
1242 L<perlrun/DESCRIPTION>, L<perlrun/Switches>,
1243 L<perldiag/"Not a perl script">,
1244 L<perldiag/"No Perl script found in input">), it should know when a
1245 program I<is a Perl>. There is some naming convention which allows
1246 Perl to distinguish correct lines from wrong ones. The above names are
1247 almost the only names allowed by this convention which do not contain
1248 digits (which have absolutely different semantics).
1250 =head2 Why dynamic linking?
1252 Well, having several executables dynamically linked to the same huge
1253 library has its advantages, but this would not substantiate the
1254 additional work to make it compile. The reason is stupid-but-quick
1255 "hard" dynamic linking used by OS/2.
1257 The address tables of DLLs are patched only once, when they are
1258 loaded. The addresses of entry points into DLLs are guaranteed to be
1259 the same for all programs which use the same DLL, which reduces the
1260 amount of runtime patching - once DLL is loaded, its code is
1263 While this allows some performance advantages, this makes life
1264 terrible for developers, since the above scheme makes it impossible
1265 for a DLL to be resolved to a symbol in the .EXE file, since this
1266 would need a DLL to have different relocations tables for the
1267 executables which use it.
1269 However, a Perl extension is forced to use some symbols from the perl
1270 executable, say to know how to find the arguments provided on the perl
1271 internal evaluation stack. The solution is that the main code of
1272 interpreter should be contained in a DLL, and the F<.EXE> file just loads
1273 this DLL into memory and supplies command-arguments.
1275 This I<greatly> increases the load time for the application (as well as
1276 the number of problems during compilation). Since interpreter is in a DLL,
1277 the CRT is basically forced to reside in a DLL as well (otherwise
1278 extensions would not be able to use CRT).
1280 =head2 Why chimera build?
1282 Current EMX environment does not allow DLLs compiled using Unixish
1283 C<a.out> format to export symbols for data. This forces C<omf>-style
1284 compile of F<perl.dll>.
1286 Current EMX environment does not allow F<.EXE> files compiled in
1287 C<omf> format to fork(). fork() is needed for exactly three Perl
1292 =item explicit fork()
1300 opening pipes to itself.
1304 While these operations are not questions of life and death, a lot of
1305 useful scripts use them. This forces C<a.out>-style compile of
1311 Here we list environment variables with are either OS/2- and DOS- and
1312 Win*-specific, or are more important under OS/2 than under other OSes.
1314 =head2 C<PERLLIB_PREFIX>
1316 Specific for EMX port. Should have the form
1324 If the beginning of some prebuilt path matches F<path1>, it is
1325 substituted with F<path2>.
1327 Should be used if the perl library is moved from the default
1328 location in preference to C<PERL(5)LIB>, since this would not leave wrong
1329 entries in @INC. Say, if the compiled version of perl looks for @INC
1330 in F<f:/perllib/lib>, and you want to install the library in
1333 set PERLLIB_PREFIX=f:/perllib/lib;h:/opt/gnu
1335 =head2 C<PERL_BADLANG>
1337 If 1, perl ignores setlocale() failing. May be useful with some
1340 =head2 C<PERL_BADFREE>
1342 If 1, perl would not warn of in case of unwarranted free(). May be
1343 useful in conjunction with the module DB_File, since Berkeley DB
1344 memory handling code is buggy.
1346 =head2 C<PERL_SH_DIR>
1348 Specific for EMX port. Gives the directory part of the location for
1351 =head2 C<USE_PERL_FLOCK>
1353 Specific for EMX port. Since L<flock(3)> is present in EMX, but is not
1354 functional, it is emulated by perl. To disable the emulations, set
1355 environment variable C<USE_PERL_FLOCK=0>.
1357 =head2 C<TMP> or C<TEMP>
1359 Specific for EMX port. Used as storage place for temporary files, most
1360 notably C<-e> scripts.
1364 Here we list major changes which could make you by surprise.
1368 C<setpriority> and C<getpriority> are not compatible with earlier
1369 ports by Andreas Kaiser. See C<"setpriority, getpriority">.
1371 =head2 DLL name mangling
1373 With the release 5.003_01 the dynamically loadable libraries
1374 should be rebuilt. In particular, DLLs are now created with the names
1375 which contain a checksum, thus allowing workaround for OS/2 scheme of
1380 As of release 5.003_01 perl is linked to multithreaded CRT
1381 DLL. Perl itself is not multithread-safe, as is not perl
1382 malloc(). However, extensions may use multiple thread on their own
1385 Needed to compile C<Perl/Tk> for XFree86-OS/2 out-of-the-box.
1387 =head2 Calls to external programs
1389 Due to a popular demand the perl external program calling has been
1390 changed wrt Andreas Kaiser's port. I<If> perl needs to call an
1391 external program I<via shell>, the F<f:/bin/sh.exe> will be called, or
1392 whatever is the override, see L<"PERL_SH_DIR">.
1394 Thus means that you need to get some copy of a F<sh.exe> as well (I
1395 use one from pdksh). The drive F: above is set up automatically during
1396 the build to a correct value on the builder machine, but is
1397 overridable at runtime,
1399 B<Reasons:> a consensus on C<perl5-porters> was that perl should use
1400 one non-overridable shell per platform. The obvious choices for OS/2
1401 are F<cmd.exe> and F<sh.exe>. Having perl build itself would be impossible
1402 with F<cmd.exe> as a shell, thus I picked up C<sh.exe>. Thus assures almost
1403 100% compatibility with the scripts coming from *nix. As an added benefit
1404 this works as well under DOS if you use DOS-enabled port of pdksh
1405 (see L<"Prerequisites">).
1407 B<Disadvantages:> currently F<sh.exe> of pdksh calls external programs
1408 via fork()/exec(), and there is I<no> functioning exec() on
1409 OS/2. exec() is emulated by EMX by asyncroneous call while the caller
1410 waits for child completion (to pretend that the C<pid> did not change). This
1411 means that 1 I<extra> copy of F<sh.exe> is made active via fork()/exec(),
1412 which may lead to some resources taken from the system (even if we do
1413 not count extra work needed for fork()ing).
1415 Note that this a lesser issue now when we do not spawn F<sh.exe>
1416 unless needed (metachars found).
1418 One can always start F<cmd.exe> explicitly via
1420 system 'cmd', '/c', 'mycmd', 'arg1', 'arg2', ...
1422 If you need to use F<cmd.exe>, and do not want to hand-edit thousands of your
1423 scripts, the long-term solution proposed on p5-p is to have a directive
1427 which will override system(), exec(), C<``>, and
1428 C<open(,'...|')>. With current perl you may override only system(),
1429 readpipe() - the explicit version of C<``>, and maybe exec(). The code
1430 will substitute the one-argument call to system() by
1431 C<CORE::system('cmd.exe', '/c', shift)>.
1433 If you have some working code for C<OS2::Cmd>, please send it to me,
1434 I will include it into distribution. I have no need for such a module, so
1437 =head2 Memory allocation
1439 Perl uses its own malloc() under OS/2 - interpreters are usually malloc-bound
1440 for speed, but perl is not, since its malloc is lightning-fast.
1441 Unfortunately, it is also quite frivolous with memory usage as well.
1443 Since kitchen-top machines are usually low on memory, perl is compiled with
1444 all the possible memory-saving options. This probably makes perl's
1445 malloc() as greedy with memory as the neighbor's malloc(), but still
1446 much quickier. Note that this is true only for a "typical" usage,
1447 it is possible that the perl malloc will be worse for some very special usage.
1449 Combination of perl's malloc() and rigid DLL name resolution creates
1450 a special problem with library functions which expect their return value to
1451 be free()d by system's free(). To facilitate extensions which need to call
1452 such functions, system memory-allocation functions are still available with
1453 the prefix C<emx_> added. (Currently only DLL perl has this, it should
1454 propagate to F<perl_.exe> shortly.)
1460 I include 3 extensions by Andreas Kaiser, OS2::REXX, OS2::UPM, and OS2::FTP,
1461 into my ftp directory, mirrored on CPAN. I made
1462 some minor changes needed to compile them by standard tools. I cannot
1463 test UPM and FTP, so I will appreciate your feedback. Other extensions
1464 there are OS2::ExtAttr, OS2::PrfDB for tied access to EAs and .INI
1465 files - and maybe some other extensions at the time you read it.
1467 Note that OS2 perl defines 2 pseudo-extension functions
1468 OS2::Copy::copy and DynaLoader::mod2fname (many more now, see
1469 L<Prebuilt methods>).
1471 The -R switch of older perl is deprecated. If you need to call a REXX code
1472 which needs access to variables, include the call into a REXX compartment
1474 REXX_call {...block...};
1476 Two new functions are supported by REXX code,
1478 REXX_eval_with 'string', REXX_function_name => \&perl_sub_reference;
1480 If you have some other extensions you want to share, send the code to
1481 me. At least two are available: tied access to EA's, and tied access
1482 to system databases.
1486 Ilya Zakharevich, ilya@math.ohio-state.edu