1PERLWIN32(1)           Perl Programmers Reference Guide           PERLWIN32(1)
2
3
4

NAME

6       perlwin32 - Perl under Windows
7

SYNOPSIS

9       These are instructions for building Perl under Windows 9x/NT/2000/XP on
10       the Intel x86 and Itanium architectures.
11

DESCRIPTION

13       Before you start, you should glance through the README file found in
14       the top-level directory to which the Perl distribution was extracted.
15       Make sure you read and understand the terms under which this software
16       is being distributed.
17
18       Also make sure you read "BUGS AND CAVEATS" below for the known limita‐
19       tions of this port.
20
21       The INSTALL file in the perl top-level has much information that is
22       only relevant to people building Perl on Unix-like systems.  In partic‐
23       ular, you can safely ignore any information that talks about "Config‐
24       ure".
25
26       You may also want to look at two other options for building a perl that
27       will work on Windows NT:  the README.cygwin and README.os2 files, each
28       of which give a different set of rules to build a Perl that will work
29       on Win32 platforms.  Those two methods will probably enable you to
30       build a more Unix-compatible perl, but you will also need to download
31       and use various other build-time and run-time support software
32       described in those files.
33
34       This set of instructions is meant to describe a so-called "native" port
35       of Perl to Win32 platforms.  This includes both 32-bit and 64-bit Win‐
36       dows operating systems.  The resulting Perl requires no additional
37       software to run (other than what came with your operating system).
38       Currently, this port is capable of using one of the following compilers
39       on the Intel x86 architecture:
40
41             Borland C++           version 5.02 or later
42             Microsoft Visual C++  version 2.0 or later
43             MinGW with gcc        gcc version 2.95.2 or later
44
45       The last of these is a high quality freeware compiler.  Use version
46       3.2.x or later for the best results with this compiler.
47
48       The Borland C++ and Microsoft Visual C++ compilers are also now being
49       given away free.  The Borland compiler is available as "Borland C++
50       Compiler Free Command Line Tools" and is the same compiler that ships
51       with the full "Borland C++ Builder" product.  The Microsoft compiler is
52       available as "Visual C++ Toolkit 2003", and also as part of the ".NET
53       Framework SDK", and is the same compiler that ships with "Visual Studio
54       .NET 2003 Professional".
55
56       This port can also be built on the Intel IA64 using:
57
58             Microsoft Platform SDK    Nov 2001 (64-bit compiler and tools)
59
60       The MS Platform SDK can be downloaded from http://www.microsoft.com/.
61
62       This port fully supports MakeMaker (the set of modules that is used to
63       build extensions to perl).  Therefore, you should be able to build and
64       install most extensions found in the CPAN sites.  See "Usage Hints for
65       Perl on Win32" below for general hints about this.
66
67       Setting Up Perl on Win32
68
69       Make
70           You need a "make" program to build the sources.  If you are using
71           Visual C++ or the Platform SDK tools under Windows NT/2000/XP,
72           nmake will work.  All other builds need dmake.
73
74           dmake is a freely available make that has very nice macro features
75           and parallelability.
76
77           A port of dmake for Windows is available from:
78
79               http://search.cpan.org/dist/dmake/
80
81           Fetch and install dmake somewhere on your path.
82
83           There exists a minor coexistence problem with dmake and Borland C++
84           compilers.  Namely, if a distribution has C files named with mixed
85           case letters, they will be compiled into appropriate .obj-files
86           named with all lowercase letters, and every time dmake is invoked
87           to bring files up to date, it will try to recompile such files
88           again.  For example, Tk distribution has a lot of such files,
89           resulting in needless recompiles every time dmake is invoked.  To
90           avoid this, you may use the script "sync_ext.pl" after a successful
91           build.  It is available in the win32 subdirectory of the Perl
92           source distribution.
93
94       Command Shell
95           Use the default "cmd" shell that comes with NT.  Some versions of
96           the popular 4DOS/NT shell have incompatibilities that may cause you
97           trouble.  If the build fails under that shell, try building again
98           with the cmd shell.
99
100           The nmake Makefile also has known incompatibilities with the "com‐
101           mand.com" shell that comes with Windows 9x.  You will need to use
102           dmake and makefile.mk to build under Windows 9x.
103
104           The surest way to build it is on Windows NT/2000/XP, using the cmd
105           shell.
106
107           Make sure the path to the build directory does not contain spaces.
108           The build usually works in this circumstance, but some tests will
109           fail.
110
111       Borland C++
112           If you are using the Borland compiler, you will need dmake.  (The
113           make that Borland supplies is seriously crippled and will not work
114           for MakeMaker builds.)
115
116           See "Make" above.
117
118       Microsoft Visual C++
119           The nmake that comes with Visual C++ will suffice for building.
120           You will need to run the VCVARS32.BAT file, usually found somewhere
121           like C:\MSDEV4.2\BIN or C:\Program Files\Microsoft Visual Stu‐
122           dio\VC98\Bin.  This will set your build environment.
123
124           You can also use dmake to build using Visual C++; provided, how‐
125           ever, you set OSRELEASE to "microsft" (or whatever the directory
126           name under which the Visual C dmake configuration lives) in your
127           environment and edit win32/config.vc to change "make=nmake" into
128           "make=dmake".  The latter step is only essential if you want to use
129           dmake as your default make for building extensions using MakeMaker.
130
131       Microsoft Visual C++ Toolkit 2003
132           This free toolkit contains the same compiler and linker that ship
133           with Visual Studio .NET 2003 Professional, but doesn't contain
134           everything necessary to build Perl.
135
136           You will also need to download the "Platform SDK" (the "Core SDK"
137           and "MDAC SDK" components are required) for header files, libraries
138           and rc.exe, and ".NET Framework SDK" for more libraries and
139           nmake.exe.  Note that the latter (which also includes the free com‐
140           piler and linker) requires the ".NET Framework Redistributable" to
141           be installed first.  This can be downloaded and installed sepa‐
142           rately, but is included in the "Visual C++ Toolkit 2003" anyway.
143
144           These packages can all be downloaded by searching in the Download
145           Center at http://www.microsoft.com/downloads/search.aspx?display
146           lang=en.  (Providing exact links to these packages has proven a
147           pointless task because the links keep on changing so often.)
148
149           Try to obtain the latest version of the Platform SDK.  Sometimes
150           these packages contain a particular Windows OS version in their
151           name, but actually work on other OS versions too.  For example, the
152           "Windows Server 2003 SP1 Platform SDK" also runs on Windows XP SP2
153           and Windows 2000.
154
155           According to the download pages the Toolkit and the .NET Framework
156           SDK are only supported on Windows 2000/XP/2003, so trying to use
157           these tools on Windows 95/98/ME and even Windows NT probably won't
158           work.
159
160           Install the Toolkit first, then the Platform SDK, then the .NET
161           Framework SDK.  Setup your environment as follows (assuming default
162           installation locations were chosen):
163
164                   SET PATH=%SystemRoot%\system32;%SystemRoot%;C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin;C:\Program Files\Microsoft SDK\Bin;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin
165                   SET INCLUDE=C:\Program Files\Microsoft Visual C++ Toolkit 2003\include;C:\Program Files\Microsoft SDK\include;C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include
166                   SET LIB=C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;C:\Program Files\Microsoft SDK\lib;C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib
167
168           Several required files will still be missing:
169
170           *   cvtres.exe is required by link.exe when using a .res file.  It
171               is actually installed by the .NET Framework SDK, but into a
172               location such as the following:
173
174                       C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322
175
176               Copy it from there to C:\Program Files\Microsoft SDK\Bin
177
178           *   lib.exe is normally used to build libraries, but link.exe with
179               the /lib option also works, so change win32/config.vc to use it
180               instead:
181
182               Change the line reading:
183
184                       ar='lib'
185
186               to:
187
188                       ar='link /lib'
189
190               It may also be useful to create a batch file called lib.bat in
191               C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin contain‐
192               ing:
193
194                       @echo off
195                       link /lib %*
196
197               for the benefit of any naughty C extension modules that you
198               might want to build later which explicitly reference "lib"
199               rather than taking their value from $Config{ar}.
200
201           *   setargv.obj is required to build perlglob.exe (and perl.exe if
202               the USE_SETARGV option is enabled).  The Platform SDK supplies
203               this object file in source form in C:\Program Files\Microsoft
204               SDK\src\crt.  Copy setargv.c, cruntime.h and internal.h from
205               there to some temporary location and build setargv.obj using
206
207                       cl.exe /c /I. /D_CRTBLD setargv.c
208
209               Then copy setargv.obj to C:\Program Files\Microsoft SDK\lib
210
211               Alternatively, if you don't need perlglob.exe and don't need to
212               enable the USE_SETARGV option then you can safely just remove
213               all mention of $(GLOBEXE) from win32/Makefile and setargv.obj
214               won't be required anyway.
215
216           Perl should now build using the win32/Makefile.  You will need to
217           edit that file to set
218
219                   CCTYPE = MSVC70FREE
220
221           and to set CCHOME, CCINCDIR and CCLIBDIR as per the environment
222           setup above.
223
224       Microsoft Platform SDK 64-bit Compiler
225           The nmake that comes with the Platform SDK will suffice for build‐
226           ing Perl.  Make sure you are building within one of the "Build
227           Environment" shells available after you install the Platform SDK
228           from the Start Menu.
229
230       MinGW release 3 with gcc
231           The latest release of MinGW at the time of writing is 3.1.0, which
232           contains gcc-3.2.3.  It can be downloaded here:
233
234               http://www.mingw.org/
235
236           Perl also compiles with earlier releases of gcc (2.95.2 and up).
237           See below for notes about using earlier versions of MinGW/gcc.
238
239           You also need dmake.  See "Make" above on how to get it.
240
241       MinGW release 1 with gcc
242           The MinGW-1.1 bundle contains gcc-2.95.3.
243
244           Make sure you install the binaries that work with MSVCRT.DLL as
245           indicated in the README for the GCC bundle.  You may need to set up
246           a few environment variables (usually ran from a batch file).
247
248           There are a couple of problems with the version of
249           gcc-2.95.2-msvcrt.exe released 7 November 1999:
250
251           *   It left out a fix for certain command line quotes.  To fix
252               this, be sure to download and install the file
253               fixes/quote-fix-msvcrt.exe from the above ftp location.
254
255           *   The definition of the fpos_t type in stdio.h may be wrong.  If
256               your stdio.h has this problem, you will see an exception when
257               running the test t/lib/io_xs.t.  To fix this, change the type‐
258               def for fpos_t from "long" to "long long" in the file
259               i386-mingw32msvc/include/stdio.h, and rebuild.
260
261           A potentially simpler to install (but probably soon-to-be-outdated)
262           bundle of the above package with the mentioned fixes already
263           applied is available here:
264
265               http://downloads.ActiveState.com/pub/staff/gsar/gcc-2.95.2-msvcrt.zip
266               ftp://ftp.ActiveState.com/pub/staff/gsar/gcc-2.95.2-msvcrt.zip
267
268       Building
269
270       ·   Make sure you are in the "win32" subdirectory under the perl
271           toplevel.  This directory contains a "Makefile" that will work with
272           versions of nmake that come with Visual C++ or the Platform SDK,
273           and a dmake "makefile.mk" that will work for all supported compil‐
274           ers.  The defaults in the dmake makefile are setup to build using
275           MinGW/gcc.
276
277       ·   Edit the makefile.mk (or Makefile, if you're using nmake) and
278           change the values of INST_DRV and INST_TOP.   You can also enable
279           various build flags.  These are explained in the makefiles.
280
281           Note that it is generally not a good idea to try to build a perl
282           with INST_DRV and INST_TOP set to a path that already exists from a
283           previous build.  In particular, this may cause problems with the
284           lib/ExtUtils/t/Embed.t test, which attempts to build a test program
285           and may end up building against the installed perl's lib/CORE
286           directory rather than the one being tested.
287
288           You will have to make sure that CCTYPE is set correctly and that
289           CCHOME points to wherever you installed your compiler.
290
291           The default value for CCHOME in the makefiles for Visual C++ may
292           not be correct for some versions.  Make sure the default exists and
293           is valid.
294
295           You may also need to comment out the "DELAYLOAD = ..." line in the
296           Makefile if you're using VC++ 6.0 without the latest service pack
297           and the linker reports an internal error.
298
299           If you have either the source or a library that contains
300           des_fcrypt(), enable the appropriate option in the makefile.  A
301           ready-to-use version of fcrypt.c, based on the version originally
302           written by Eric Young at ftp://ftp.funet.fi/pub/crypt/mir‐
303           rors/dsi/libdes/, is bundled with the distribution and CRYPT_SRC is
304           set to use it.  Alternatively, if you have built a library that
305           contains des_fcrypt(), you can set CRYPT_LIB to point to the
306           library name.  Perl will also build without des_fcrypt(), but the
307           crypt() builtin will fail at run time.
308
309           If you want build some core extensions statically into perl's dll,
310           specify them in the STATIC_EXT macro.
311
312           Be sure to read the instructions near the top of the makefiles
313           carefully.
314
315       ·   Type "dmake" (or "nmake" if you are using that make).
316
317           This should build everything.  Specifically, it will create
318           perl.exe, perl58.dll at the perl toplevel, and various other exten‐
319           sion dll's under the lib\auto directory.  If the build fails for
320           any reason, make sure you have done the previous steps correctly.
321
322       Testing Perl on Win32
323
324       Type "dmake test" (or "nmake test").  This will run most of the tests
325       from the testsuite (many tests will be skipped).
326
327       There should be no test failures when running under Windows NT/2000/XP.
328       Many tests will fail under Windows 9x due to the inferior command
329       shell.
330
331       Some test failures may occur if you use a command shell other than the
332       native "cmd.exe", or if you are building from a path that contains spa‐
333       ces.  So don't do that.
334
335       If you are running the tests from a emacs shell window, you may see
336       failures in op/stat.t.  Run "dmake test-notty" in that case.
337
338       If you're using the Borland compiler, you may see a failure in
339       op/taint.t arising from the inability to find the Borland Runtime DLLs
340       on the system default path.  You will need to copy the DLLs reported by
341       the messages from where Borland chose to install it, into the Windows
342       system directory (usually somewhere like C:\WINNT\SYSTEM32) and rerun
343       the test.
344
345       If you're using Borland compiler versions 5.2 and below, you may run
346       into problems finding the correct header files when building exten‐
347       sions.  For example, building the "Tk" extension may fail because both
348       perl and Tk contain a header file called "patchlevel.h".  The latest
349       Borland compiler (v5.5) is free of this misbehaviour, and it even sup‐
350       ports an option -VI- for backward (bugward) compatibility for using the
351       old Borland search algorithm  to locate header files.
352
353       If you run the tests on a FAT partition, you may see some failures for
354       "link()" related tests:
355
356           Failed Test                     Stat Wstat Total Fail  Failed  List
357
358           ../ext/IO/lib/IO/t/io_dup.t                    6    4  66.67%  2-5
359           ../lib/File/Temp/t/mktemp.t                    9    1  11.11%  2
360           ../lib/File/Temp/t/posix.t                     7    1  14.29%  3
361           ../lib/File/Temp/t/security.t                 13    1   7.69%  2
362           ../lib/File/Temp/t/tempfile.t                 20    2  10.00%  2 4
363           comp/multiline.t                               6    2  33.33%  5-6
364           io/dup.t                                       8    6  75.00%  2-7
365           op/write.t                                    47    7  14.89%  1-3 6 9-11
366
367       Testing on NTFS avoids these errors.
368
369       Furthermore, you should make sure that during "make test" you do not
370       have any GNU tool packages in your path: some toolkits like Unixutils
371       include some tools ("type" for instance) which override the Windows
372       ones and makes tests fail. Remove them from your path while testing to
373       avoid these errors.
374
375       Please report any other failures as described under "BUGS AND CAVEATS".
376
377       Installation of Perl on Win32
378
379       Type "dmake install" (or "nmake install").  This will put the newly
380       built perl and the libraries under whatever "INST_TOP" points to in the
381       Makefile.  It will also install the pod documentation under
382       "$INST_TOP\$INST_VER\lib\pod" and HTML versions of the same under
383       "$INST_TOP\$INST_VER\lib\pod\html".
384
385       To use the Perl you just installed you will need to add a new entry to
386       your PATH environment variable: "$INST_TOP\bin", e.g.
387
388           set PATH=c:\perl\bin;%PATH%
389
390       If you opted to uncomment "INST_VER" and "INST_ARCH" in the makefile
391       then the installation structure is a little more complicated and you
392       will need to add two new PATH components instead:
393       "$INST_TOP\$INST_VER\bin" and "$INST_TOP\$INST_VER\bin\$ARCHNAME", e.g.
394
395           set PATH=c:\perl\5.6.0\bin;c:\perl\5.6.0\bin\MSWin32-x86;%PATH%
396
397       Usage Hints for Perl on Win32
398
399       Environment Variables
400           The installation paths that you set during the build get compiled
401           into perl, so you don't have to do anything additional to start
402           using that perl (except add its location to your PATH variable).
403
404           If you put extensions in unusual places, you can set PERL5LIB to a
405           list of paths separated by semicolons where you want perl to look
406           for libraries.  Look for descriptions of other environment vari‐
407           ables you can set in perlrun.
408
409           You can also control the shell that perl uses to run system() and
410           backtick commands via PERL5SHELL.  See perlrun.
411
412           Perl does not depend on the registry, but it can look up certain
413           default values if you choose to put them there.  Perl attempts to
414           read entries from "HKEY_CURRENT_USER\Software\Perl" and
415           "HKEY_LOCAL_MACHINE\Software\Perl".  Entries in the former override
416           entries in the latter.  One or more of the following entries (of
417           type REG_SZ or REG_EXPAND_SZ) may be set:
418
419               lib-$]              version-specific standard library path to add to @INC
420               lib                 standard library path to add to @INC
421               sitelib-$]          version-specific site library path to add to @INC
422               sitelib             site library path to add to @INC
423               vendorlib-$]        version-specific vendor library path to add to @INC
424               vendorlib           vendor library path to add to @INC
425               PERL*               fallback for all %ENV lookups that begin with "PERL"
426
427           Note the $] in the above is not literal.  Substitute whatever ver‐
428           sion of perl you want to honor that entry, e.g. 5.6.0.  Paths must
429           be separated with semicolons, as usual on win32.
430
431       File Globbing
432           By default, perl handles file globbing using the File::Glob exten‐
433           sion, which provides portable globbing.
434
435           If you want perl to use globbing that emulates the quirks of DOS
436           filename conventions, you might want to consider using File::Dos‐
437           Glob to override the internal glob() implementation.  See
438           File::DosGlob for details.
439
440       Using perl from the command line
441           If you are accustomed to using perl from various command-line
442           shells found in UNIX environments, you will be less than pleased
443           with what Windows offers by way of a command shell.
444
445           The crucial thing to understand about the Windows environment is
446           that the command line you type in is processed twice before Perl
447           sees it.  First, your command shell (usually CMD.EXE on Windows NT,
448           and COMMAND.COM on Windows 9x) preprocesses the command line, to
449           handle redirection, environment variable expansion, and location of
450           the executable to run. Then, the perl executable splits the remain‐
451           ing command line into individual arguments, using the C runtime
452           library upon which Perl was built.
453
454           It is particularly important to note that neither the shell nor the
455           C runtime do any wildcard expansions of command-line arguments (so
456           wildcards need not be quoted).  Also, the quoting behaviours of the
457           shell and the C runtime are rudimentary at best (and may, if you
458           are using a non-standard shell, be inconsistent).  The only (use‐
459           ful) quote character is the double quote (").  It can be used to
460           protect spaces and other special characters in arguments.
461
462           The Windows NT documentation has almost no description of how the
463           quoting rules are implemented, but here are some general observa‐
464           tions based on experiments: The C runtime breaks arguments at spa‐
465           ces and passes them to programs in argc/argv.  Double quotes can be
466           used to prevent arguments with spaces in them from being split up.
467           You can put a double quote in an argument by escaping it with a
468           backslash and enclosing the whole argument within double quotes.
469           The backslash and the pair of double quotes surrounding the argu‐
470           ment will be stripped by the C runtime.
471
472           The file redirection characters "<", ">", and "⎪" can be quoted by
473           double quotes (although there are suggestions that this may not
474           always be true).  Single quotes are not treated as quotes by the
475           shell or the C runtime, they don't get stripped by the shell (just
476           to make this type of quoting completely useless).  The caret "^"
477           has also been observed to behave as a quoting character, but this
478           appears to be a shell feature, and the caret is not stripped from
479           the command line, so Perl still sees it (and the C runtime phase
480           does not treat the caret as a quote character).
481
482           Here are some examples of usage of the "cmd" shell:
483
484           This prints two doublequotes:
485
486               perl -e "print '\"\"' "
487
488           This does the same:
489
490               perl -e "print \"\\\"\\\"\" "
491
492           This prints "bar" and writes "foo" to the file "blurch":
493
494               perl -e "print 'foo'; print STDERR 'bar'" > blurch
495
496           This prints "foo" ("bar" disappears into nowhereland):
497
498               perl -e "print 'foo'; print STDERR 'bar'" 2> nul
499
500           This prints "bar" and writes "foo" into the file "blurch":
501
502               perl -e "print 'foo'; print STDERR 'bar'" 1> blurch
503
504           This pipes "foo" to the "less" pager and prints "bar" on the con‐
505           sole:
506
507               perl -e "print 'foo'; print STDERR 'bar'" ⎪ less
508
509           This pipes "foo\nbar\n" to the less pager:
510
511               perl -le "print 'foo'; print STDERR 'bar'" 2>&1 ⎪ less
512
513           This pipes "foo" to the pager and writes "bar" in the file
514           "blurch":
515
516               perl -e "print 'foo'; print STDERR 'bar'" 2> blurch ⎪ less
517
518           Discovering the usefulness of the "command.com" shell on Windows 9x
519           is left as an exercise to the reader :)
520
521           One particularly pernicious problem with the 4NT command shell for
522           Windows NT is that it (nearly) always treats a % character as indi‐
523           cating that environment variable expansion is needed.  Under this
524           shell, it is therefore important to always double any % characters
525           which you want Perl to see (for example, for hash variables), even
526           when they are quoted.
527
528       Building Extensions
529           The Comprehensive Perl Archive Network (CPAN) offers a wealth of
530           extensions, some of which require a C compiler to build.  Look in
531           http://www.cpan.org/ for more information on CPAN.
532
533           Note that not all of the extensions available from CPAN may work in
534           the Win32 environment; you should check the information at
535           http://testers.cpan.org/ before investing too much effort into
536           porting modules that don't readily build.
537
538           Most extensions (whether they require a C compiler or not) can be
539           built, tested and installed with the standard mantra:
540
541               perl Makefile.PL
542               $MAKE
543               $MAKE test
544               $MAKE install
545
546           where $MAKE is whatever 'make' program you have configured perl to
547           use.  Use "perl -V:make" to find out what this is.  Some extensions
548           may not provide a testsuite (so "$MAKE test" may not do anything or
549           fail), but most serious ones do.
550
551           It is important that you use a supported 'make' program, and ensure
552           Config.pm knows about it.  If you don't have nmake, you can either
553           get dmake from the location mentioned earlier or get an old version
554           of nmake reportedly available from:
555
556            http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/nmake15.exe
557
558           Another option is to use the make written in Perl, available from
559           CPAN.
560
561               http://www.cpan.org/modules/by-module/Make/
562
563           You may also use dmake.  See "Make" above on how to get it.
564
565           Note that MakeMaker actually emits makefiles with different syntax
566           depending on what 'make' it thinks you are using.  Therefore, it is
567           important that one of the following values appears in Config.pm:
568
569               make='nmake'        # MakeMaker emits nmake syntax
570               make='dmake'        # MakeMaker emits dmake syntax
571               any other value     # MakeMaker emits generic make syntax
572                                       (e.g GNU make, or Perl make)
573
574           If the value doesn't match the 'make' program you want to use, edit
575           Config.pm to fix it.
576
577           If a module implements XSUBs, you will need one of the supported C
578           compilers.  You must make sure you have set up the environment for
579           the compiler for command-line compilation.
580
581           If a module does not build for some reason, look carefully for why
582           it failed, and report problems to the module author.  If it looks
583           like the extension building support is at fault, report that with
584           full details of how the build failed using the perlbug utility.
585
586       Command-line Wildcard Expansion
587           The default command shells on DOS descendant operating systems
588           (such as they are) usually do not expand wildcard arguments sup‐
589           plied to programs.  They consider it the application's job to han‐
590           dle that.  This is commonly achieved by linking the application (in
591           our case, perl) with startup code that the C runtime libraries usu‐
592           ally provide.  However, doing that results in incompatible perl
593           versions (since the behavior of the argv expansion code differs
594           depending on the compiler, and it is even buggy on some compilers).
595           Besides, it may be a source of frustration if you use such a perl
596           binary with an alternate shell that *does* expand wildcards.
597
598           Instead, the following solution works rather well. The nice things
599           about it are 1) you can start using it right away; 2) it is more
600           powerful, because it will do the right thing with a pattern like
601           */*/*.c; 3) you can decide whether you do/don't want to use it; and
602           4) you can extend the method to add any customizations (or even
603           entirely different kinds of wildcard expansion).
604
605                   C:\> copy con c:\perl\lib\Wild.pm
606                   # Wild.pm - emulate shell @ARGV expansion on shells that don't
607                   use File::DosGlob;
608                   @ARGV = map {
609                                 my @g = File::DosGlob::glob($_) if /[*?]/;
610                                 @g ? @g : $_;
611                               } @ARGV;
612                   1;
613                   ^Z
614                   C:\> set PERL5OPT=-MWild
615                   C:\> perl -le "for (@ARGV) { print }" */*/perl*.c
616                   p4view/perl/perl.c
617                   p4view/perl/perlio.c
618                   p4view/perl/perly.c
619                   perl5.005/win32/perlglob.c
620                   perl5.005/win32/perllib.c
621                   perl5.005/win32/perlglob.c
622                   perl5.005/win32/perllib.c
623                   perl5.005/win32/perlglob.c
624                   perl5.005/win32/perllib.c
625
626           Note there are two distinct steps there: 1) You'll have to create
627           Wild.pm and put it in your perl lib directory. 2) You'll need to
628           set the PERL5OPT environment variable.  If you want argv expansion
629           to be the default, just set PERL5OPT in your default startup envi‐
630           ronment.
631
632           If you are using the Visual C compiler, you can get the C runtime's
633           command line wildcard expansion built into perl binary.  The
634           resulting binary will always expand unquoted command lines, which
635           may not be what you want if you use a shell that does that for you.
636           The expansion done is also somewhat less powerful than the approach
637           suggested above.
638
639       Win32 Specific Extensions
640           A number of extensions specific to the Win32 platform are available
641           from CPAN.  You may find that many of these extensions are meant to
642           be used under the Activeware port of Perl, which used to be the
643           only native port for the Win32 platform.  Since the Activeware port
644           does not have adequate support for Perl's extension building tools,
645           these extensions typically do not support those tools either and,
646           therefore, cannot be built using the generic steps shown in the
647           previous section.
648
649           To ensure smooth transitioning of existing code that uses the
650           ActiveState port, there is a bundle of Win32 extensions that con‐
651           tains all of the ActiveState extensions and several other Win32
652           extensions from CPAN in source form, along with many added bug‐
653           fixes, and with MakeMaker support.  The latest version of this bun‐
654           dle is available at:
655
656               http://search.cpan.org/dist/libwin32/
657
658           See the README in that distribution for building and installation
659           instructions.
660
661       Notes on 64-bit Windows
662           Windows .NET Server supports the LLP64 data model on the Intel Ita‐
663           nium architecture.
664
665           The LLP64 data model is different from the LP64 data model that is
666           the norm on 64-bit Unix platforms.  In the former, "int" and "long"
667           are both 32-bit data types, while pointers are 64 bits wide.  In
668           addition, there is a separate 64-bit wide integral type, "__int64".
669           In contrast, the LP64 data model that is pervasive on Unix plat‐
670           forms provides "int" as the 32-bit type, while both the "long" type
671           and pointers are of 64-bit precision.  Note that both models pro‐
672           vide for 64-bits of addressability.
673
674           64-bit Windows running on Itanium is capable of running 32-bit x86
675           binaries transparently.  This means that you could use a 32-bit
676           build of Perl on a 64-bit system.  Given this, why would one want
677           to build a 64-bit build of Perl?  Here are some reasons why you
678           would bother:
679
680           *   A 64-bit native application will run much more efficiently on
681               Itanium hardware.
682
683           *   There is no 2GB limit on process size.
684
685           *   Perl automatically provides large file support when built under
686               64-bit Windows.
687
688           *   Embedding Perl inside a 64-bit application.
689
690       Running Perl Scripts
691
692       Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to indicate to
693       the OS that it should execute the file using perl.  Win32 has no compa‐
694       rable means to indicate arbitrary files are executables.
695
696       Instead, all available methods to execute plain text files on Win32
697       rely on the file "extension".  There are three methods to use this to
698       execute perl scripts:
699
700       1       There is a facility called "file extension associations" that
701               will work in Windows NT 4.0.  This can be manipulated via the
702               two commands "assoc" and "ftype" that come standard with Win‐
703               dows NT 4.0.  Type "ftype /?" for a complete example of how to
704               set this up for perl scripts (Say what?  You thought Windows NT
705               wasn't perl-ready? :).
706
707       2       Since file associations don't work everywhere, and there are
708               reportedly bugs with file associations where it does work, the
709               old method of wrapping the perl script to make it look like a
710               regular batch file to the OS, may be used.  The install process
711               makes available the "pl2bat.bat" script which can be used to
712               wrap perl scripts into batch files.  For example:
713
714                       pl2bat foo.pl
715
716               will create the file "FOO.BAT".  Note "pl2bat" strips any .pl
717               suffix and adds a .bat suffix to the generated file.
718
719               If you use the 4DOS/NT or similar command shell, note that
720               "pl2bat" uses the "%*" variable in the generated batch file to
721               refer to all the command line arguments, so you may need to
722               make sure that construct works in batch files.  As of this
723               writing, 4DOS/NT users will need a "ParameterChar = *" state‐
724               ment in their 4NT.INI file or will need to execute "setdos /p*"
725               in the 4DOS/NT startup file to enable this to work.
726
727       3       Using "pl2bat" has a few problems:  the file name gets changed,
728               so scripts that rely on $0 to find what they must do may not
729               run properly; running "pl2bat" replicates the contents of the
730               original script, and so this process can be maintenance inten‐
731               sive if the originals get updated often.  A different approach
732               that avoids both problems is possible.
733
734               A script called "runperl.bat" is available that can be copied
735               to any filename (along with the .bat suffix).  For example, if
736               you call it "foo.bat", it will run the file "foo" when it is
737               executed.  Since you can run batch files on Win32 platforms
738               simply by typing the name (without the extension), this effec‐
739               tively runs the file "foo", when you type either "foo" or
740               "foo.bat".  With this method, "foo.bat" can even be in a dif‐
741               ferent location than the file "foo", as long as "foo" is avail‐
742               able somewhere on the PATH.  If your scripts are on a filesys‐
743               tem that allows symbolic links, you can even avoid copying
744               "runperl.bat".
745
746               Here's a diversion:  copy "runperl.bat" to "runperl", and type
747               "runperl".  Explain the observed behavior, or lack thereof. :)
748               Hint: .gnidnats llits er'uoy fi ,"lrepnur" eteled :tniH
749
750       Miscellaneous Things
751
752       A full set of HTML documentation is installed, so you should be able to
753       use it if you have a web browser installed on your system.
754
755       "perldoc" is also a useful tool for browsing information contained in
756       the documentation, especially in conjunction with a pager like "less"
757       (recent versions of which have Win32 support).  You may have to set the
758       PAGER environment variable to use a specific pager.  "perldoc -f foo"
759       will print information about the perl operator "foo".
760
761       One common mistake when using this port with a GUI library like "Tk" is
762       assuming that Perl's normal behavior of opening a command-line window
763       will go away.  This isn't the case.  If you want to start a copy of
764       "perl" without opening a command-line window, use the "wperl" exe‐
765       cutable built during the installation process.  Usage is exactly the
766       same as normal "perl" on Win32, except that options like "-h" don't
767       work (since they need a command-line window to print to).
768
769       If you find bugs in perl, you can run "perlbug" to create a bug report
770       (you may have to send it manually if "perlbug" cannot find a mailer on
771       your system).
772

BUGS AND CAVEATS

774       Norton AntiVirus interferes with the build process, particularly if set
775       to "AutoProtect, All Files, when Opened". Unlike large applications the
776       perl build process opens and modifies a lot of files. Having the the
777       AntiVirus scan each and every one slows build the process signifi‐
778       cantly.  Worse, with PERLIO=stdio the build process fails with peculiar
779       messages as the virus checker interacts badly with miniperl.exe writing
780       configure files (it seems to either catch file part written and treat
781       it as suspicious, or virus checker may have it "locked" in a way which
782       inhibits miniperl updating it). The build does complete with
783
784          set PERLIO=perlio
785
786       but that may be just luck. Other AntiVirus software may have similar
787       issues.
788
789       Some of the built-in functions do not act exactly as documented in
790       perlfunc, and a few are not implemented at all.  To avoid surprises,
791       particularly if you have had prior exposure to Perl in other operating
792       environments or if you intend to write code that will be portable to
793       other environments, see perlport for a reasonably definitive list of
794       these differences.
795
796       Not all extensions available from CPAN may build or work properly in
797       the Win32 environment.  See "Building Extensions".
798
799       Most "socket()" related calls are supported, but they may not behave as
800       on Unix platforms.  See perlport for the full list.  Perl requires
801       Winsock2 to be installed on the system. If you're running Win95, you
802       can download Winsock upgrade from here:
803
804       http://www.microsoft.com/windows95/downloads/contents/WUAd
805       minTools/S_WUNetworkingTools/W95Sockets2/Default.asp
806
807       Later OS versions already include Winsock2 support.
808
809       Signal handling may not behave as on Unix platforms (where it doesn't
810       exactly "behave", either :).  For instance, calling "die()" or "exit()"
811       from signal handlers will cause an exception, since most implementa‐
812       tions of "signal()" on Win32 are severely crippled.  Thus, signals may
813       work only for simple things like setting a flag variable in the han‐
814       dler.  Using signals under this port should currently be considered
815       unsupported.
816
817       Please send detailed descriptions of any problems and solutions that
818       you may find to <perlbug@perl.org>, along with the output produced by
819       "perl -V".
820

ACKNOWLEDGEMENTS

822       The use of a camel with the topic of Perl is a trademark of O'Reilly
823       and Associates, Inc. Used with permission.
824

AUTHORS

826       Gary Ng <71564.1743@CompuServe.COM>
827       Gurusamy Sarathy <gsar@activestate.com>
828       Nick Ing-Simmons <nick@ing-simmons.net>
829       Jan Dubois <jand@activestate.com>
830       Steve Hay <steve.hay@uk.radan.com>
831
832       This document is maintained by Jan Dubois.
833

SEE ALSO

835       perl
836

HISTORY

838       This port was originally contributed by Gary Ng around 5.003_24, and
839       borrowed from the Hip Communications port that was available at the
840       time.  Various people have made numerous and sundry hacks since then.
841
842       Borland support was added in 5.004_01 (Gurusamy Sarathy).
843
844       GCC/mingw32 support was added in 5.005 (Nick Ing-Simmons).
845
846       Support for PERL_OBJECT was added in 5.005 (ActiveState Tool Corp).
847
848       Support for fork() emulation was added in 5.6 (ActiveState Tool Corp).
849
850       Win9x support was added in 5.6 (Benjamin Stuhl).
851
852       Support for 64-bit Windows added in 5.8 (ActiveState Corp).
853
854       Last updated: 30 September 2005
855
856
857
858perl v5.8.8                       2006-01-07                      PERLWIN32(1)
Impressum