From: Dean Pentcheff Newsgroups: comp.lang.perl.misc Date: 14 May 1997 16:14:00 -0400 Organization: Univ. of South Carolina, Columbia [This is repost of a "recipe" I posted some time ago. The details may have changed, but I think the basics are still true.] I recently went through the exercise of hunting for a DOS/Win Perl, needing to write a Perl program that would run on Unix, DOS 5, and Windows 95/NT, and be distributable (along with Perl) with a minimum of fuss. I settled on Ilya Zakharevich's OS/2 port of Perl. Yup. It will run on DOS and Windows systems. It's a very full Perl port that is aggressively maintained and kept up to date. You'll need to tinker slightly. Following is an outline of a recipe that worked for me. Grab the port from CPAN. Start at and look for "Software", then "Alien Ports", then "CPAN/ports", and follow links until you get to OS/2 ports, the subdirectory "os2". *** NOTE from cpan@perl.org: if you are reading this *** file as CPAN/ports/msdos/dosperlp.txt *** or (CPAN/ports/win31/dosperlp.txt), the "os2" *** subdirectory is visible also right here, as *** CPAN/ports/msdos/os2 (or CPAN/ports/win31/os2) Within that is a set of zip files. Get these files: perl_aou.zip perl_mlb.zip perl_pod.zip perl_ste.zip perl_utl.zip plREADME.zip Make sure you have a decent unzip utility on DOS/Win. One that works is Info-Zip's, which you can grab from the "arcers" directory of the MSDOS section of the Simtel archives at oak.oakland.edu (). That file will unzip into multiple files, including a good DOS unzip program. The reason you need a good one is that you need to unzip into a tree, and you need to properly truncate long filenames -- that unzipper seems to do the job properly. OK, now that you've got the code and an unzipper, do the following to create a Perl hierarchy (the following manipulation gets done from a DOS window, if you're under Windows): cd \ mkdir perl mkdir perl\bin mkdir perl\lib mkdir perl\lib\pod Now unpack the zip files into appropriate directories. To do that, change directories to the target directory first, then from there, unzip the archive files as follows: perl plREADME.zip perl\bin perl_aou.zip perl_utl.zip perl\lib perl_mlb.zip perl_ste.zip perl\lib\pod perl_pod.zip Put the following in your autoexec.bat (carefully noting the slash directions in the text that follows): set path=...your...existing...path...;c:\perl\bin set perllib_prefix=f:/perllib c:/perl (I assume your perl destination is drive "c:", otherwise modify the "c:"s above appropriately, but don't change the "f:"). ===== Note: The following is from Ilya Zakharevich: ===== As I mentioned it in another post today, unless you install sh.exe from sh_dos.zip, and set PERL_SH_DIR according to the docs, you are not going to have backticks and pipes working. ========================================================= Now, based on addresses in Ilya's documentation, go out and grab the latest versions of the "emxrt" package and the "rsx" package. Unzip them under a temporary directory. Copy the following files to c:\perl\bin: from the emx package: emx.exe [VCPI DOS extender for DOS] emxfpemu [coprocessor emulator for 386sx machines] emxbind.exe [emx executable load-format twiddling program] emxl.exe [emx stub loader module] from the rsx package: rsx.exe [DPMI DOS extender for Windows] Now drop out into DOS if you're running under Windows (not a DOS shell: if you're in Windows, kill Windows and drop to plain DOS). Go to the c:\perl\bin directory and use emxbind to extract the a.out module from perl_.exe, something like: emx emxbind.exe -x perl_.exe perl.out Use emxbind to bind the a.out module with the emxl.exe stub: emx emxbind.exe emxl.exe perl.out perl.exe Assuming that worked, you can now delete the following files: emxbind.exe emxl.exe perl.out perl_.exe perl5_00.exe If you're really twitchy about a startup warning message under Windows, you can use a hex editor or other binary editor to edit the file "rsx.exe" so that it will not complain about the emx version you're using. In the file "rsx.exe", search for the string "emx_version". You'll find the emx version number in reverse, something like: "emx_version=b9.0" (which really refers to emx version number 0.9b). Change the version number/letter to fit the emxrt version you downloaded (in my case, recently, I changed "b9.0" to "c9.0", which defines me as really twitchy I suppose). Save the new rsx.exe (must be in the filename "rsx.exe"). Then the runtime warning about emx versions will shut up. Reboot your machine to let the c:\autoexec.bat changes take effect. What have you achieved by this? The OS/2 version will run using either the emx.exe DOS extender (using the VCPI protocol, suitable for "naked" DOS) or the rsx.exe extender (using the DPMI protocol, compatible with Windows 3.x, 95 (and NT?)). The rigamarole with emxbind pulled out the core executable and rebound it with a stub loader that will automatically and transparently find and use the emx.exe extender in plain DOS, and the rsx.exe extender under Windows (as long as they're in a directory on the PATH). Setting the emxlib_prefix variable properly sets Perl's @INC list of where to search for Perl libraries. The "utility" programs in \perl\bin are set up as OS/2 "cmd" files. You'll need to trim off the top few lines that get them to execute under the OS/2 command interpreter. There are magical incantations you can do to turn them into automatically executing DOS batch files (which I don't know), or you can create a batch file for each of them (in the same directory) that looks something like the following (for an example "utility.cmd" file): @perl -S utility.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9 in the file "\perl\bin\utility.bat". And that's that! -Dean -- N. Dean Pentcheff WWW: http://tbone.biol.sc.edu/~dean/ Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-3936) PGP ID=768/22A1A015 Keyprint=2D 53 87 53 72 4A F2 83 A0 BF CB C0 D1 0E 76 C0 Get PGP keys and information with the command: "finger dean@tbone.biol.sc.edu"