home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _d1bf3cd23d1e8b9d085aa89710e0fb22 < prev    next >
Text File  |  2000-03-23  |  31KB  |  571 lines

  1. <HTML>
  2. <HEAD>
  3. <TITLE>perlwin32 - Perl under Win32</TITLE>
  4. <LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
  5. <LINK REV="made" HREF="mailto:">
  6. </HEAD>
  7.  
  8. <BODY>
  9. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  10. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  11. <STRONG><P CLASS=block> perlwin32 - Perl under Win32</P></STRONG>
  12. </TD></TR>
  13. </TABLE>
  14.  
  15. <A NAME="__index__"></A>
  16. <!-- INDEX BEGIN -->
  17.  
  18. <UL>
  19.  
  20.     <LI><A HREF="#name">NAME</A></LI>
  21.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  22.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  23.     <UL>
  24.  
  25.         <LI><A HREF="#setting up">Setting Up</A></LI>
  26.         <LI><A HREF="#building">Building</A></LI>
  27.         <LI><A HREF="#testing">Testing</A></LI>
  28.         <LI><A HREF="#installation">Installation</A></LI>
  29.         <LI><A HREF="#usage hints">Usage Hints</A></LI>
  30.     </UL>
  31.  
  32.     <LI><A HREF="#bugs and caveats">BUGS AND CAVEATS</A></LI>
  33.     <LI><A HREF="#authors">AUTHORS</A></LI>
  34.     <LI><A HREF="#see also">SEE ALSO</A></LI>
  35.     <LI><A HREF="#history">HISTORY</A></LI>
  36. </UL>
  37. <!-- INDEX END -->
  38.  
  39. <HR>
  40. <P>
  41. <H1><A NAME="name">NAME</A></H1>
  42. <P>perlwin32 - Perl under Win32</P>
  43. <P>
  44. <HR>
  45. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  46. <P>These are instructions for building Perl under Windows (9x, NT and
  47. 2000).</P>
  48. <P>
  49. <HR>
  50. <H1><A NAME="description">DESCRIPTION</A></H1>
  51. <P>Before you start, you should glance through the README file
  52. found in the top-level directory where the Perl distribution
  53. was extracted.  Make sure you read and understand the terms under
  54. which this software is being distributed.</P>
  55. <P>Also make sure you read <A HREF="#bugs and caveats">BUGS AND CAVEATS</A> below for the
  56. known limitations of this port.</P>
  57. <P>The INSTALL file in the perl top-level has much information that is
  58. only relevant to people building Perl on Unix-like systems.  In
  59. particular, you can safely ignore any information that talks about
  60. ``Configure''.</P>
  61. <P>You may also want to look at two other options for building
  62. a perl that will work on Windows NT:  the README.cygwin and
  63. README.os2 files, which each give a different set of rules to build
  64. a Perl that will work on Win32 platforms.  Those two methods will
  65. probably enable you to build a more Unix-compatible perl, but you
  66. will also need to download and use various other build-time and
  67. run-time support software described in those files.</P>
  68. <P>This set of instructions is meant to describe a so-called ``native''
  69. port of Perl to Win32 platforms.  The resulting Perl requires no
  70. additional software to run (other than what came with your operating
  71. system).  Currently, this port is capable of using one of the
  72. following compilers:</P>
  73. <PRE>
  74.       Borland C++               version 5.02 or later
  75.       Microsoft Visual C++      version 4.2 or later
  76.       Mingw32 with GCC          version 2.95.2 or better</PRE>
  77. <P>The last of these is a high quality freeware compiler.  Support
  78. for it is still experimental.  (Older versions of GCC are known
  79. not to work.)</P>
  80. <P>This port currently supports MakeMaker (the set of modules that
  81. is used to build extensions to perl).  Therefore, you should be
  82. able to build and install most extensions found in the CPAN sites.
  83. See <A HREF="#usage hints">Usage Hints</A> below for general hints about this.</P>
  84. <P>
  85. <H2><A NAME="setting up">Setting Up</A></H2>
  86. <DL>
  87. <DT><STRONG><A NAME="item_Make">Make</A></STRONG><BR>
  88. <DD>
  89. You need a ``make'' program to build the sources.  If you are using
  90. Visual C++ under Windows NT or 2000, nmake will work.  All other
  91. builds need dmake.
  92. <P>dmake is a freely available make that has very nice macro features
  93. and parallelability.</P>
  94. <P>A port of dmake for Windows is available from:</P>
  95. <PRE>
  96.     <A HREF="http://www.cpan.org/authors/id/GSAR/dmake-4.1pl1-win32.zip">http://www.cpan.org/authors/id/GSAR/dmake-4.1pl1-win32.zip</A></PRE>
  97. <P>(This is a fixed version of original dmake sources obtained from
  98. <A HREF="http://www.wticorp.com/dmake/.">http://www.wticorp.com/dmake/.</A>  As of version 4.1PL1, the original
  99. sources did not build as shipped, and had various other problems.
  100. A patch is included in the above fixed version.)</P>
  101. <P>Fetch and install dmake somewhere on your path (follow the instructions
  102. in the README.NOW file).</P>
  103. <P></P>
  104. <DT><STRONG><A NAME="item_Command_Shell">Command Shell</A></STRONG><BR>
  105. <DD>
  106. Use the default ``cmd'' shell that comes with NT.  Some versions of the
  107. popular 4DOS/NT shell have incompatibilities that may cause you trouble.
  108. If the build fails under that shell, try building again with the cmd
  109. shell.
  110. <P>The nmake Makefile also has known incompatibilites with the
  111. ``command.com'' shell that comes with Windows 9x.  You will need to
  112. use dmake and makefile.mk to build under Windows 9x.</P>
  113. <P>The surest way to build it is on Windows NT, using the cmd shell.</P>
  114. <P>Make sure the path to the build directory does not contain spaces.  The
  115. build usually works in this circumstance, but some tests will fail.</P>
  116. <P></P>
  117. <DT><STRONG><A NAME="item_Borland_C%2B%2B">Borland C++</A></STRONG><BR>
  118. <DD>
  119. If you are using the Borland compiler, you will need dmake.
  120. (The make that Borland supplies is seriously crippled, and will not
  121. work for MakeMaker builds.)
  122. <P>See L/``Make''> above.</P>
  123. <P></P>
  124. <DT><STRONG><A NAME="item_Microsoft_Visual_C%2B%2B">Microsoft Visual C++</A></STRONG><BR>
  125. <DD>
  126. The nmake that comes with Visual C++ will suffice for building.
  127. You will need to run the VCVARS32.BAT file usually found somewhere
  128. like C:\MSDEV4.2\BIN.  This will set your build environment.
  129. <P>You can also use dmake to build using Visual C++, provided:
  130. you set OSRELEASE to ``microsft'' (or whatever the directory name
  131. under which the Visual C dmake configuration lives) in your environment,
  132. and edit win32/config.vc to change ``make=nmake'' into ``make=dmake''.  The
  133. latter step is only essential if you want to use dmake as your default
  134. make for building extensions using MakeMaker.</P>
  135. <P></P>
  136. <DT><STRONG><A NAME="item_Mingw32_with_GCC">Mingw32 with GCC</A></STRONG><BR>
  137. <DD>
  138. GCC-2.95.2 binaries can be downloaded from:
  139. <PRE>
  140.     <A HREF="ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/">ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/</A></PRE>
  141. <P>The GCC-2.95.2 bundle comes with Mingw32 libraries and headers.</P>
  142. <P>Make sure you install the binaries that work with MSVCRT.DLL as indicated
  143. in the README for the GCC bundle.  You may need to set up a few environment
  144. variables (usually run from a batch file).</P>
  145. <P>You also need dmake.  See <A HREF="#make">Make</A> above on how to get it.</P>
  146. <P></P></DL>
  147. <P>
  148. <H2><A NAME="building">Building</A></H2>
  149. <UL>
  150. <LI>
  151. Make sure you are in the ``win32'' subdirectory under the perl toplevel.
  152. This directory contains a ``Makefile'' that will work with
  153. versions of nmake that come with Visual C++, and a dmake ``makefile.mk''
  154. that will work for all supported compilers.  The defaults in the dmake
  155. makefile are setup to build using the GCC compiler.
  156. <P></P>
  157. <LI>
  158. Edit the makefile.mk (or Makefile, if using nmake) and change the values
  159. of INST_DRV and INST_TOP.   You can also enable various build
  160. flags.  These are explained in the makefiles.
  161. <P>You will have to make sure CCTYPE is set correctly, and CCHOME points
  162. to wherever you installed your compiler.</P>
  163. <P>The default value for CCHOME in the makefiles for Visual C++
  164. may not be correct for some versions.  Make sure the default exists
  165. and is valid.</P>
  166. <P>If you have either the source or a library that contains des_fcrypt(),
  167. enable the appropriate option in the makefile.  <CODE>des_fcrypt()</CODE> is not
  168. bundled with the distribution due to US Government restrictions
  169. on the export of cryptographic software.  Nevertheless, this routine
  170. is part of the ``libdes'' library (written by Eric Young) which is widely
  171. available worldwide, usually along with SSLeay (for example:
  172. ``ftp://fractal.mta.ca/pub/crypto/SSLeay/DES/'').  Set CRYPT_SRC to the
  173. name of the file that implements des_fcrypt().  Alternatively, if
  174. you have built a library that contains des_fcrypt(), you can set
  175. CRYPT_LIB to point to the library name.  The location above contains
  176. many versions of the ``libdes'' library, all with slightly different
  177. implementations of des_fcrypt().  Older versions have a single,
  178. self-contained file (fcrypt.c) that implements crypt(), so they may be
  179. easier to use.  A patch against the fcrypt.c found in libdes-3.06 is
  180. in des_fcrypt.patch.</P>
  181. <P>Perl will also build without des_fcrypt(), but the <A HREF="../../lib/Pod/perlfunc.html#item_crypt"><CODE>crypt()</CODE></A> builtin will
  182. fail at run time.</P>
  183. <P>Be sure to read the instructions near the top of the makefiles carefully.</P>
  184. <P></P>
  185. <LI>
  186. Type ``dmake'' (or ``nmake'' if you are using that make).
  187. <P>This should build everything.  Specifically, it will create perl.exe,
  188. perl56.dll at the perl toplevel, and various other extension dll's
  189. under the lib\auto directory.  If the build fails for any reason, make
  190. sure you have done the previous steps correctly.</P>
  191. <P></P></UL>
  192. <P>
  193. <H2><A NAME="testing">Testing</A></H2>
  194. <P>Type ``dmake test'' (or ``nmake test'').  This will run most of the tests from
  195. the testsuite (many tests will be skipped).</P>
  196. <P>No tests should typically fail when running Windows NT 4.0.  Under Windows
  197. 2000, test 22 in lib/open3.t is known to fail (cause still unknown).  Many
  198. tests will fail under Windows 9x due to the inferior command shell.</P>
  199. <P>Some test failures may occur if you use a command shell other than the
  200. native ``cmd.exe'', or if you are building from a path that contains
  201. spaces.  So don't do that.</P>
  202. <P>If you are running the tests from a emacs shell window, you may see
  203. failures in op/stat.t.  Run ``dmake test-notty'' in that case.</P>
  204. <P>If you're using the Borland compiler, you may see a failure in op/taint.t
  205. arising from the inability to find the Borland Runtime DLLs on the system
  206. default path.  You will need to copy the DLLs reported by the messages
  207. from where Borland chose to install it, into the Windows system directory
  208. (usually somewhere like C:\WINNT\SYSTEM32), and rerun the test.</P>
  209. <P>Please report any other failures as described under <A HREF="#bugs and caveats">BUGS AND CAVEATS</A>.</P>
  210. <P>
  211. <H2><A NAME="installation">Installation</A></H2>
  212. <P>Type ``dmake install'' (or ``nmake install'').  This will put the newly
  213. built perl and the libraries under whatever <CODE>INST_TOP</CODE> points to in the
  214. Makefile.  It will also install the pod documentation under
  215. <CODE>$INST_TOP\$VERSION\lib\pod</CODE> and HTML versions of the same under
  216. <CODE>$INST_TOP\$VERSION\lib\pod\html</CODE>.  To use the Perl you just installed,
  217. you will need to add two components to your PATH environment variable,
  218. <CODE>$INST_TOP\$VERSION\bin</CODE>, and <CODE>$INST_TOP\$VERSION\bin\$ARCHNAME</CODE>.
  219. For example:</P>
  220. <PRE>
  221.     set PATH c:\perl\5.6.0\bin;c:\perl\5.6.0\bin\MSWin32-x86;%PATH%</PRE>
  222. <P>If you opt to comment out INST_VER and INST_ARCH in the makefiles, the
  223. installation structure is much simpler.  In that case, it will be
  224. sufficient to add a single entry to the path, for instance:</P>
  225. <PRE>
  226.     set PATH c:\perl\bin;%PATH%</PRE>
  227. <P>
  228. <H2><A NAME="usage hints">Usage Hints</A></H2>
  229. <DL>
  230. <DT><STRONG><A NAME="item_Environment_Variables">Environment Variables</A></STRONG><BR>
  231. <DD>
  232. The installation paths that you set during the build get compiled
  233. into perl, so you don't have to do anything additional to start
  234. using that perl (except add its location to your PATH variable).
  235. <P>If you put extensions in unusual places, you can set PERL5LIB
  236. to a list of paths separated by semicolons where you want perl
  237. to look for libraries.  Look for descriptions of other environment
  238. variables you can set in <A HREF="../../lib/Pod/perlrun.html">the perlrun manpage</A>.</P>
  239. <P>You can also control the shell that perl uses to run <A HREF="../../lib/Pod/perlfunc.html#item_system"><CODE>system()</CODE></A> and
  240. backtick commands via PERL5SHELL.  See <A HREF="../../lib/Pod/perlrun.html">the perlrun manpage</A>.</P>
  241. <P>Perl does not depend on the registry, but it can look up certain default
  242. values if you choose to put them there.  Perl attempts to read entries from
  243. <CODE>HKEY_CURRENT_USER\Software\Perl</CODE> and <CODE>HKEY_LOCAL_MACHINE\Software\Perl</CODE>.
  244. Entries in the former override entries in the latter.  One or more of the
  245. following entries (of type REG_SZ or REG_EXPAND_SZ) may be set:</P>
  246. <PRE>
  247.     lib-$]              version-specific standard library path to add to @INC
  248.     lib                 standard library path to add to @INC
  249.     sitelib-$]          version-specific site library path to add to @INC
  250.     sitelib             site library path to add to @INC
  251.     vendorlib-$]        version-specific vendor library path to add to @INC
  252.     vendorlib           vendor library path to add to @INC
  253.     PERL*               fallback for all %ENV lookups that begin with "PERL"</PRE>
  254. <P>Note the <CODE>$]</CODE> in the above is not literal.  Substitute whatever version
  255. of perl you want to honor that entry, e.g. <CODE>5.6.0</CODE>.  Paths must be
  256. separated with semicolons, as usual on win32.</P>
  257. <P></P>
  258. <DT><STRONG><A NAME="item_File_Globbing">File Globbing</A></STRONG><BR>
  259. <DD>
  260. By default, perl handles file globbing using the File::Glob extension,
  261. which provides portable globbing.
  262. <P>If you want perl to use globbing that emulates the quirks of DOS
  263. filename conventions, you might want to consider using File::DosGlob
  264. to override the internal <A HREF="../../lib/Pod/perlfunc.html#item_glob"><CODE>glob()</CODE></A> implementation.  See <A HREF="../../lib/File/DosGlob.html">the File::DosGlob manpage</A> for
  265. details.</P>
  266. <P></P>
  267. <DT><STRONG><A NAME="item_Using_perl_from_the_command_line">Using perl from the command line</A></STRONG><BR>
  268. <DD>
  269. If you are accustomed to using perl from various command-line
  270. shells found in UNIX environments, you will be less than pleased
  271. with what Windows offers by way of a command shell.
  272. <P>The crucial thing to understand about the ``cmd'' shell (which is
  273. the default on Windows NT) is that it does not do any wildcard
  274. expansions of command-line arguments (so wildcards need not be
  275. quoted).  It also provides only rudimentary quoting.  The only
  276. (useful) quote character is the double quote (``).  It can be used to
  277. protect spaces in arguments and other special characters.  The
  278. Windows NT documentation has almost no description of how the
  279. quoting rules are implemented, but here are some general observations
  280. based on experiments:  The shell breaks arguments at spaces and
  281. passes them to programs in argc/argv.  Doublequotes can be used
  282. to prevent arguments with spaces in them from being split up.
  283. You can put a double quote in an argument by escaping it with
  284. a backslash and enclosing the whole argument within double quotes.
  285. The backslash and the pair of double quotes surrounding the
  286. argument will be stripped by the shell.</P>
  287. <P>The file redirection characters ``<'', ``>'', and ``|'' cannot be quoted
  288. by double quotes (there are probably more such).  Single quotes
  289. will protect those three file redirection characters, but the
  290. single quotes don't get stripped by the shell (just to make this
  291. type of quoting completely useless).  The caret ``^'' has also
  292. been observed to behave as a quoting character (and doesn't get
  293. stripped by the shell also).</P>
  294. <P>Here are some examples of usage of the ``cmd'' shell:</P>
  295. <P>This prints two doublequotes:</P>
  296. <PRE>
  297.     perl -e "print '\"\"' "</PRE>
  298. <P>This does the same:</P>
  299. <PRE>
  300.     perl -e "print \"\\\"\\\"\" "</PRE>
  301. <P>This prints ``bar'' and writes ``foo'' to the file ``blurch'':</P>
  302. <PRE>
  303.     perl -e "print 'foo'; print STDERR 'bar'" > blurch</PRE>
  304. <P>This prints ``foo'' (``bar'' disappears into nowhereland):</P>
  305. <PRE>
  306.     perl -e "print 'foo'; print STDERR 'bar'" 2> nul</PRE>
  307. <P>This prints ``bar'' and writes ``foo'' into the file ``blurch'':</P>
  308. <PRE>
  309.     perl -e "print 'foo'; print STDERR 'bar'" 1> blurch</PRE>
  310. <P>This pipes ``foo'' to the ``less'' pager and prints ``bar'' on the console:</P>
  311. <PRE>
  312.     perl -e "print 'foo'; print STDERR 'bar'" | less</PRE>
  313. <P>This pipes ``foo\nbar\n'' to the less pager:</P>
  314. <PRE>
  315.     perl -le "print 'foo'; print STDERR 'bar'" 2>&1 | less</PRE>
  316. <P>This pipes ``foo'' to the pager and writes ``bar'' in the file ``blurch'':</P>
  317. <PRE>
  318.     perl -e "print 'foo'; print STDERR 'bar'" 2> blurch | less</PRE>
  319. <P>Discovering the usefulness of the ``command.com'' shell on Windows 9x
  320. is left as an exercise to the reader :)</P>
  321. <P></P>
  322. <DT><STRONG><A NAME="item_Building_Extensions">Building Extensions</A></STRONG><BR>
  323. <DD>
  324. The Comprehensive Perl Archive Network (CPAN) offers a wealth
  325. of extensions, some of which require a C compiler to build.
  326. Look in <A HREF="http://www.cpan.org/">http://www.cpan.org/</A> for more information on CPAN.
  327. <P>Note that not all of the extensions available from CPAN may work
  328. in the Win32 environment; you should check the information at
  329. <A HREF="http://testers.cpan.org/">http://testers.cpan.org/</A> before investing too much effort into
  330. porting modules that don't readily build.</P>
  331. <P>Most extensions (whether they require a C compiler or not) can
  332. be built, tested and installed with the standard mantra:</P>
  333. <PRE>
  334.     perl Makefile.PL
  335.     $MAKE
  336.     $MAKE test
  337.     $MAKE install</PRE>
  338. <P>where $MAKE is whatever 'make' program you have configured perl to
  339. use.  Use ``perl -V:make'' to find out what this is.  Some extensions
  340. may not provide a testsuite (so ``$MAKE test'' may not do anything, or
  341. fail), but most serious ones do.</P>
  342. <P>It is important that you use a supported 'make' program, and
  343. ensure Config.pm knows about it.  If you don't have nmake, you can
  344. either get dmake from the location mentioned earlier, or get an
  345. old version of nmake reportedly available from:</P>
  346. <PRE>
  347.     <A HREF="ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe">ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe</A></PRE>
  348. <P>Another option is to use the make written in Perl, available from
  349. CPAN:</P>
  350. <PRE>
  351.     <A HREF="http://www.cpan.org/authors/id/NI-S/Make-0.03.tar.gz">http://www.cpan.org/authors/id/NI-S/Make-0.03.tar.gz</A></PRE>
  352. <P>You may also use dmake.  See <A HREF="#make">Make</A> above on how to get it.</P>
  353. <P>Note that MakeMaker actually emits makefiles with different syntax
  354. depending on what 'make' it thinks you are using.  Therefore, it is
  355. important that one of the following values appears in Config.pm:</P>
  356. <PRE>
  357.     make='nmake'        # MakeMaker emits nmake syntax
  358.     make='dmake'        # MakeMaker emits dmake syntax
  359.     any other value     # MakeMaker emits generic make syntax
  360.                             (e.g GNU make, or Perl make)</PRE>
  361. <P>If the value doesn't match the 'make' program you want to use,
  362. edit Config.pm to fix it.</P>
  363. <P>If a module implements XSUBs, you will need one of the supported
  364. C compilers.  You must make sure you have set up the environment for
  365. the compiler for command-line compilation.</P>
  366. <P>If a module does not build for some reason, look carefully for
  367. why it failed, and report problems to the module author.  If
  368. it looks like the extension building support is at fault, report
  369. that with full details of how the build failed using the perlbug
  370. utility.</P>
  371. <P></P>
  372. <DT><STRONG><A NAME="item_Command%2Dline_Wildcard_Expansion">Command-line Wildcard Expansion</A></STRONG><BR>
  373. <DD>
  374. The default command shells on DOS descendant operating systems (such
  375. as they are) usually do not expand wildcard arguments supplied to
  376. programs.  They consider it the application's job to handle that.
  377. This is commonly achieved by linking the application (in our case,
  378. perl) with startup code that the C runtime libraries usually provide.
  379. However, doing that results in incompatible perl versions (since the
  380. behavior of the argv expansion code differs depending on the
  381. compiler, and it is even buggy on some compilers).  Besides, it may
  382. be a source of frustration if you use such a perl binary with an
  383. alternate shell that *does* expand wildcards.
  384. <P>Instead, the following solution works rather well. The nice things
  385. about it: 1) you can start using it right away 2) it is more powerful,
  386. because it will do the right thing with a pattern like */*/*.c
  387. 3) you can decide whether you do/don't want to use it 4) you can
  388. extend the method to add any customizations (or even entirely
  389. different kinds of wildcard expansion).</P>
  390. <PRE>
  391.         C:\> copy con c:\perl\lib\Wild.pm
  392.         # Wild.pm - emulate shell @ARGV expansion on shells that don't
  393.         use File::DosGlob;
  394.         @ARGV = map {
  395.                       my @g = File::DosGlob::glob($_) if /[*?]/;
  396.                       @g ? @g : $_;
  397.                     } @ARGV;
  398.         1;
  399.         ^Z
  400.         C:\> set PERL5OPT=-MWild
  401.         C:\> perl -le "for (@ARGV) { print }" */*/perl*.c
  402.         p4view/perl/perl.c
  403.         p4view/perl/perlio.c
  404.         p4view/perl/perly.c
  405.         perl5.005/win32/perlglob.c
  406.         perl5.005/win32/perllib.c
  407.         perl5.005/win32/perlglob.c
  408.         perl5.005/win32/perllib.c
  409.         perl5.005/win32/perlglob.c
  410.         perl5.005/win32/perllib.c</PRE>
  411. <P>Note there are two distinct steps there: 1) You'll have to create
  412. Wild.pm and put it in your perl lib directory. 2) You'll need to
  413. set the PERL5OPT environment variable.  If you want argv expansion
  414. to be the default, just set PERL5OPT in your default startup
  415. environment.</P>
  416. <P>If you are using the Visual C compiler, you can get the C runtime's
  417. command line wildcard expansion built into perl binary.  The resulting
  418. binary will always expand unquoted command lines, which may not be
  419. what you want if you use a shell that does that for you.  The expansion
  420. done is also somewhat less powerful than the approach suggested above.</P>
  421. <P></P>
  422. <DT><STRONG><A NAME="item_Win32_Specific_Extensions">Win32 Specific Extensions</A></STRONG><BR>
  423. <DD>
  424. A number of extensions specific to the Win32 platform are available
  425. from CPAN.  You may find that many of these extensions are meant to
  426. be used under the Activeware port of Perl, which used to be the only
  427. native port for the Win32 platform.  Since the Activeware port does not
  428. have adequate support for Perl's extension building tools, these
  429. extensions typically do not support those tools either, and therefore
  430. cannot be built using the generic steps shown in the previous section.
  431. <P>To ensure smooth transitioning of existing code that uses the
  432. ActiveState port, there is a bundle of Win32 extensions that contains
  433. all of the ActiveState extensions and most other Win32 extensions from
  434. CPAN in source form, along with many added bugfixes, and with MakeMaker
  435. support.  This bundle is available at:</P>
  436. <PRE>
  437.    <A HREF="http://www.cpan.org/authors/id/GSAR/libwin32-0.151.zip">http://www.cpan.org/authors/id/GSAR/libwin32-0.151.zip</A></PRE>
  438. <P>See the README in that distribution for building and installation
  439. instructions.  Look for later versions that may be available at the
  440. same location.</P>
  441. <P></P>
  442. <DT><STRONG><A NAME="item_Running_Perl_Scripts">Running Perl Scripts</A></STRONG><BR>
  443. <DD>
  444. Perl scripts on UNIX use the ``#!'' (a.k.a ``shebang'') line to
  445. indicate to the OS that it should execute the file using perl.
  446. Win32 has no comparable means to indicate arbitrary files are
  447. executables.
  448. <P>Instead, all available methods to execute plain text files on
  449. Win32 rely on the file ``extension''.  There are three methods
  450. to use this to execute perl scripts:</P>
  451. <OL>
  452. <LI>
  453. There is a facility called ``file extension associations'' that will
  454. work in Windows NT 4.0.  This can be manipulated via the two
  455. commands ``assoc'' and ``ftype'' that come standard with Windows NT
  456. 4.0.  Type ``ftype /?'' for a complete example of how to set this
  457. up for perl scripts (Say what?  You thought Windows NT wasn't
  458. perl-ready? :).
  459. <P></P>
  460. <LI>
  461. Since file associations don't work everywhere, and there are
  462. reportedly bugs with file associations where it does work, the
  463. old method of wrapping the perl script to make it look like a
  464. regular batch file to the OS, may be used.  The install process
  465. makes available the ``pl2bat.bat'' script which can be used to wrap
  466. perl scripts into batch files.  For example:
  467. <PRE>
  468.         pl2bat foo.pl</PRE>
  469. <P>will create the file ``FOO.BAT''.  Note ``pl2bat'' strips any
  470. .pl suffix and adds a .bat suffix to the generated file.</P>
  471. <P>If you use the 4DOS/NT or similar command shell, note that
  472. ``pl2bat'' uses the ``%*'' variable in the generated batch file to
  473. refer to all the command line arguments, so you may need to make
  474. sure that construct works in batch files.  As of this writing,
  475. 4DOS/NT users will need a ``ParameterChar = *'' statement in their
  476. 4NT.INI file, or will need to execute ``setdos /p*'' in the 4DOS/NT
  477. startup file to enable this to work.</P>
  478. <P></P>
  479. <LI>
  480. Using ``pl2bat'' has a few problems:  the file name gets changed,
  481. so scripts that rely on <CODE>$0</CODE> to find what they must do may not
  482. run properly; running ``pl2bat'' replicates the contents of the
  483. original script, and so this process can be maintenance intensive
  484. if the originals get updated often.  A different approach that
  485. avoids both problems is possible.
  486. <P>A script called ``runperl.bat'' is available that can be copied
  487. to any filename (along with the .bat suffix).  For example,
  488. if you call it ``foo.bat'', it will run the file ``foo'' when it is
  489. executed.  Since you can run batch files on Win32 platforms simply
  490. by typing the name (without the extension), this effectively
  491. runs the file ``foo'', when you type either ``foo'' or ``foo.bat''.
  492. With this method, ``foo.bat'' can even be in a different location
  493. than the file ``foo'', as long as ``foo'' is available somewhere on
  494. the PATH.  If your scripts are on a filesystem that allows symbolic
  495. links, you can even avoid copying ``runperl.bat''.</P>
  496. <P>Here's a diversion:  copy ``runperl.bat'' to ``runperl'', and type
  497. ``runperl''.  Explain the observed behavior, or lack thereof. :)
  498. Hint: .gnidnats llits er'uoy fi ,``lrepnur'' eteled :tniH</P>
  499. <P></P></OL>
  500. <DT><STRONG><A NAME="item_Miscellaneous_Things">Miscellaneous Things</A></STRONG><BR>
  501. <DD>
  502. A full set of HTML documentation is installed, so you should be
  503. able to use it if you have a web browser installed on your
  504. system.
  505. <P><CODE>perldoc</CODE> is also a useful tool for browsing information contained
  506. in the documentation, especially in conjunction with a pager
  507. like <CODE>less</CODE> (recent versions of which have Win32 support).  You may
  508. have to set the PAGER environment variable to use a specific pager.
  509. ``perldoc -f foo'' will print information about the perl operator
  510. ``foo''.</P>
  511. <P>If you find bugs in perl, you can run <CODE>perlbug</CODE> to create a
  512. bug report (you may have to send it manually if <CODE>perlbug</CODE> cannot
  513. find a mailer on your system).</P>
  514. <P></P></DL>
  515. <P>
  516. <HR>
  517. <H1><A NAME="bugs and caveats">BUGS AND CAVEATS</A></H1>
  518. <P>Some of the built-in functions do not act exactly as documented in
  519. <A HREF="../../lib/Pod/perlfunc.html">the perlfunc manpage</A>, and a few are not implemented at all.  To avoid
  520. surprises, particularly if you have had prior exposure to Perl
  521. in other operating environments or if you intend to write code
  522. that will be portable to other environments, see <A HREF="../../lib/Pod/perlport.html">the perlport manpage</A>
  523. for a reasonably definitive list of these differences.</P>
  524. <P>Not all extensions available from CPAN may build or work properly
  525. in the Win32 environment.  See <A HREF="#building extensions">Building Extensions</A>.</P>
  526. <P>Most <A HREF="../../lib/Pod/perlfunc.html#item_socket"><CODE>socket()</CODE></A> related calls are supported, but they may not
  527. behave as on Unix platforms.  See <A HREF="../../lib/Pod/perlport.html">the perlport manpage</A> for the full list.</P>
  528. <P>Signal handling may not behave as on Unix platforms (where it
  529. doesn't exactly ``behave'', either :).  For instance, calling <A HREF="../../lib/Pod/perlfunc.html#item_die"><CODE>die()</CODE></A>
  530. or <A HREF="../../lib/Pod/perlfunc.html#item_exit"><CODE>exit()</CODE></A> from signal handlers will cause an exception, since most
  531. implementations of <CODE>signal()</CODE> on Win32 are severely crippled.
  532. Thus, signals may work only for simple things like setting a flag
  533. variable in the handler.  Using signals under this port should
  534. currently be considered unsupported.</P>
  535. <P>Please send detailed descriptions of any problems and solutions that 
  536. you may find to <<EM><A HREF="mailto:perlbug@perl.com">perlbug@perl.com</A></EM>>, along with the output produced
  537. by <CODE>perl -V</CODE>.</P>
  538. <P>
  539. <HR>
  540. <H1><A NAME="authors">AUTHORS</A></H1>
  541. <P>Gary Ng <<A HREF="mailto:71564.1743@CompuServe.COM">71564.1743@CompuServe.COM</A>></P>
  542. <P>Gurusamy Sarathy <<A HREF="mailto:gsar@activestate.com">gsar@activestate.com</A>></P>
  543. <P>Nick Ing-Simmons <<A HREF="mailto:nick@ni-s.u-net.com">nick@ni-s.u-net.com</A>></P>
  544. <P>This document is maintained by Gurusamy Sarathy.</P>
  545. <P>
  546. <HR>
  547. <H1><A NAME="see also">SEE ALSO</A></H1>
  548. <P><A HREF="../../lib/Pod/perl.html">the perl manpage</A></P>
  549. <P>
  550. <HR>
  551. <H1><A NAME="history">HISTORY</A></H1>
  552. <P>This port was originally contributed by Gary Ng around 5.003_24,
  553. and borrowed from the Hip Communications port that was available
  554. at the time.  Various people have made numerous and sundry hacks
  555. since then.</P>
  556. <P>Borland support was added in 5.004_01 (Gurusamy Sarathy).</P>
  557. <P>GCC/mingw32 support was added in 5.005 (Nick Ing-Simmons).</P>
  558. <P>Support for PERL_OBJECT was added in 5.005 (ActiveState Tool Corp).</P>
  559. <P>Support for <A HREF="../../lib/Pod/perlfunc.html#item_fork"><CODE>fork()</CODE></A> emulation was added in 5.6 (ActiveState Tool Corp).</P>
  560. <P>Win9x support was added in 5.6 (Benjamin Stuhl).</P>
  561. <P>Last updated: 22 March 2000</P>
  562. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  563. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  564. <STRONG><P CLASS=block> perlwin32 - Perl under Win32</P></STRONG>
  565. </TD></TR>
  566. </TABLE>
  567.  
  568. </BODY>
  569.  
  570. </HTML>
  571.