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 7 and later.
10

DESCRIPTION

12       Before you start, you should glance through the README file found in
13       the top-level directory to which the Perl distribution was extracted.
14       Make sure you read and understand the terms under which this software
15       is being distributed.
16
17       Also make sure you read "BUGS AND CAVEATS" below for the known
18       limitations of this port.
19
20       The INSTALL file in the perl top-level has much information that is
21       only relevant to people building Perl on Unix-like systems.  In
22       particular, you can safely ignore any information that talks about
23       "Configure".
24
25       You may also want to look at one other option for building a perl that
26       will work on Windows: the README.cygwin file, which give a different
27       set of rules to build a perl for Windows.  This method will probably
28       enable you to build a more Unix-compatible perl, but you will also need
29       to download and use various other build-time and run-time support
30       software described in that file.
31
32       This set of instructions is meant to describe a so-called "native" port
33       of Perl to the Windows platform.  This includes both 32-bit and 64-bit
34       Windows operating systems.  The resulting Perl requires no additional
35       software to run (other than what came with your operating system).
36       Currently, this port is capable of using one of the following compilers
37       on the Intel x86 and x86_64 architectures:
38
39             Microsoft Visual C++    version 12.0 or later
40             Intel C++ Compiler      (experimental)
41             Gcc by mingw.org        gcc version 3.4.5-5.3.0
42             Gcc by mingw-w64.org    gcc version 4.4.3 or later
43
44       Note that the last two of these are actually competing projects both
45       delivering complete gcc toolchain for MS Windows:
46
47       <https://osdn.net/projects/mingw/>
48           Delivers gcc toolchain building 32-bit executables (which can be
49           used both 32 and 64 bit Windows platforms)
50
51       <https://mingw-w64.org>
52           Delivers gcc toolchain targeting both 64-bit Windows and 32-bit
53           Windows platforms (despite the project name "mingw-w64" they are
54           not only 64-bit oriented). They deliver the native gcc compilers
55           and cross-compilers that are also supported by perl's makefile.
56
57       The Microsoft Visual C++ compilers are also now being given away free.
58       They are available as "Visual C++ 2013-2022 Community Edition" and are
59       the same compilers that ship with "Visual C++ 2013-2022 Professional".
60
61       Visual C++ 2013 is capable of targeting XP and Windows Server 2003 but
62       the build host requirement is Windows 7/Windows Server 2012. For more
63       details see
64       https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2013-compatibility-vs
65       and
66       https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2013-sysrequirements-vs
67
68       The MinGW64 compiler is available at <https://mingw-w64.org>.  The
69       latter is actually a cross-compiler targeting Win64. There's also a
70       trimmed down compiler (no java, or gfortran) suitable for building perl
71       available at: <https://strawberryperl.com/package/kmx/64_gcctoolchain/>
72
73       NOTE: If you're using a 32-bit compiler to build perl on a 64-bit
74       Windows operating system, then you should set the WIN64 environment
75       variable to "undef".  Also, the trimmed down compiler only passes tests
76       when USE_ITHREADS *= define (as opposed to undef) and when the CFG *=
77       Debug line is commented out.
78
79       This port fully supports MakeMaker (the set of modules that is used to
80       build extensions to perl).  Therefore, you should be able to build and
81       install most extensions found in the CPAN sites.  See "Usage Hints for
82       Perl on Windows" below for general hints about this.
83
84   Setting Up Perl on Windows
85       Make
86           You need a "make" program to build the sources.  If you are using
87           Visual C++, you can use nmake supplied with Visual C++.  You may
88           also use gmake instead of nmake.  Builds using gcc need gmake.
89           nmake is not supported for gcc builds.  Parallel building is only
90           supported with gmake, not nmake.
91
92       Command Shell
93           Use the default "cmd" shell that comes with Windows.  Some versions
94           of the popular 4DOS/NT shell have incompatibilities that may cause
95           you trouble.  If the build fails under that shell, try building
96           again with the cmd shell.
97
98           Make sure the path to the build directory does not contain spaces.
99           The build usually works in this circumstance, but some tests will
100           fail.
101
102       Microsoft Visual C++
103           The nmake that comes with Visual C++ will suffice for building.
104           Visual C++ requires that certain things be set up in the console
105           before Visual C++ will successfully run. To make a console box be
106           able to run the C compiler, you will need to beforehand, run
107           "vcvarsall.bat x86" to compile for x86-32 and for x86-64
108           "vcvarsall.bat amd64". On a typical install of a Microsoft C++
109           compiler product, these batch files will already be in your "PATH"
110           environment variable so you may just type them without an absolute
111           path into your console. If you need to find the absolute path to
112           the batch file, it is usually found somewhere like C:\Program Files
113           (x86)\Microsoft Visual Studio 14.0\VC.  With some newer Microsoft C
114           products (released after ~2004), the installer will put a shortcut
115           in the start menu to launch a new console window with the console
116           already set up for your target architecture (x86-32 or x86-64 or
117           IA64).  With the newer compilers, you may also use the older batch
118           files if you choose so.
119
120       Microsoft Visual C++ 2013-2022 Community Edition
121           These free versions of Visual C++ 2013-2022 Professional contain
122           the same compilers and linkers that ship with the full versions,
123           and also contain everything necessary to build Perl.
124
125           These packages can be downloaded from
126           <https://visualstudio.microsoft.com/>.
127
128           Install Visual C++ 2013-2022 Community, then setup your environment
129           using, e.g.
130
131           C:\Program Files\Microsoft Visual Studio
132           12.0\Common7\Tools\vsvars32.bat
133
134           (assuming the default installation location was chosen).
135
136           Perl should now build using the win32/Makefile.  You will need to
137           edit that file to set "CCTYPE" to one of "MSVC120"-"MSVC143" first.
138
139       Microsoft C++ Build Tools
140           There's also a standalone (IDE-less) version of the build tools
141           mentioned above containing the MSVC compiler available for download
142           from <https://visualstudio.microsoft.com/visual-cpp-build-tools/>.
143
144           This is also referred to as Build Tools for Visual Studio.
145
146       GCC Perl can be compiled with gcc from MinGW (version 3.4.5 or later)
147           or from MinGW64 (version 4.4.3 or later).  It can be downloaded
148           here:
149
150           <https://osdn.net/projects/mingw/> <https://www.mingw-w64.org/>
151
152           You also need gmake. Usually it comes with MinGW but its executable
153           may have a different name, such as mingw32-make.exe.
154
155           Note that the MinGW build currently fails with version 6.3.0 or
156           later.
157
158           Note also that the C++ mode build currently fails with MinGW 3.4.5
159           and 4.7.2 or later, and with MinGW64 64-bit 6.3.0 or later.
160
161       Intel C++ Compiler
162           Experimental support for using Intel C++ Compiler has been added.
163           Edit win32/Makefile and pick the correct "CCTYPE" for the Visual C
164           that Intel C was installed into. Also uncomment "__ICC" to enable
165           Intel C on Visual C support.  To set up the build environment, from
166           the Start Menu run IA-32 Visual Studio 20__ mode or Intel 64 Visual
167           Studio 20__ mode as appropriate. Then run "nmake" as usual in that
168           prompt box.
169
170           Only Intel C++ Compiler v12.1 has been tested. Other versions
171           probably will work. Using Intel C++ Compiler instead of Visual C
172           has the benefit of C99 compatibility which is needed by some CPAN
173           XS modules, while maintaining compatibility with Visual C object
174           code and Visual C debugging infrastructure unlike GCC.
175
176   Building
177       •   Make sure you are in the win32 subdirectory under the perl
178           toplevel.  This directory contains a Makefile that will work with
179           versions of "nmake" that come with Visual C++, and a GNU make
180           GNUmakefile that will work for all supported compilers.  The
181           defaults in the "gmake" makefile are set up to build with
182           MinGW/gcc.
183
184       •   Edit the GNUmakefile (or Makefile, if you're using nmake) and
185           change the values of INST_DRV and "INST_TOP". You can also enable
186           various build flags. These are explained in the makefiles.
187
188           Note that it is generally not a good idea to try to build a "perl"
189           with "INST_DRV" and "INST_TOP" set to a path that already exists
190           from a previous build.  In particular, this may cause problems with
191           the lib/ExtUtils/t/Embed.t test, which attempts to build a test
192           program and may end up building against the installed "perl"'s
193           lib/CORE directory rather than the one being tested.
194
195           You will have to make sure that "CCTYPE" is set correctly and that
196           "CCHOME" points to wherever you installed your compiler.  For GCC
197           this should be the directory that contains the bin, include and lib
198           directories.
199
200           If building with the cross-compiler provided by mingw-w64.org
201           you'll need to uncomment the line that sets "GCCCROSS" in the
202           GNUmakefile. Do this only if it's the cross-compiler, ie. only if
203           the bin folder doesn't contain a gcc.exe. (The cross-compiler does
204           not provide a gcc.exe, g++.exe, ar.exe, etc. Instead, all of these
205           executables are prefixed with "x86_64-w64-mingw32-".)
206
207           The default value for "CCHOME" in the makefiles for Visual C++ may
208           not be correct for some versions.  Make sure the default exists and
209           is valid.
210
211           If you want build some core extensions statically into "perl"'s
212           DLL, specify them in the "STATIC_EXT" macro.
213
214           Be sure to read the instructions near the top of the makefiles
215           carefully.
216
217       •   Type "gmake" (or "nmake" if you are using that version of "make").
218
219           This should build everything.  Specifically, it will create
220           perl.exe, perl538.dll at the perl toplevel, and various other
221           extension DLL's under the lib\auto directory.  If the build fails
222           for any reason, make sure you have done the previous steps
223           correctly.
224
225           To try "gmake"'s parallel mode, type "gmake -j2" where 2 is the
226           maximum number of parallel jobs you want to run. A number of things
227           in the build process will run in parallel, but there are
228           serialization points where you will see just 1 CPU maxed out. This
229           is normal.
230
231           If you are advanced enough with building C code, here is a
232           suggestion to speed up building "perl", and the later "make test".
233           Try to keep your "PATH" environment variable with the least number
234           of folders possible (remember to keep your C compiler's folders
235           there). C:\WINDOWS\system32 or C:\WINNT\system32 depending on your
236           OS version should be first folder in "PATH", since "cmd.exe" is the
237           most commonly launched program during the build and later testing.
238
239   Testing Perl on Windows
240       Type "gmake test" (or "nmake test").  This will run most of the tests
241       from the testsuite (many tests will be skipped).
242
243       There should be no test failures.
244
245       If you build with Visual C++ 2013 then three tests currently may fail
246       with Daylight Saving Time related problems: t/io/fs.t,
247       cpan/HTTP-Tiny/t/110_mirror.t and lib/File/Copy.t. The failures are
248       caused by bugs in the CRT in VC++ 2013 which are fixed in VC++2015 and
249       later, as explained by Microsoft here:
250       <https://connect.microsoft.com/VisualStudio/feedback/details/811534/utime-sometimes-fails-to-set-the-correct-file-times-in-visual-c-2013>.
251       In the meantime, if you need fixed "stat" and "utime" functions then
252       have a look at the CPAN distribution Win32::UTCFileTime.
253
254       If you build with Visual C++ 2015 or later then
255       ext/XS-APItest/t/locale.t may crash (after all its tests have passed).
256       This is due to a regression in the Universal CRT introduced in the
257       Windows 10 April 2018 Update, and will be fixed in the May 2019 Update,
258       as explained here:
259       <https://developercommunity.visualstudio.com/content/problem/519486/setlocalelc-numeric-iso-latin-16-fails-then-succee.html>.
260
261       If you build with certain versions (e.g. 4.8.1) of gcc from mingw then
262       ext/POSIX/t/time.t may fail test 17 due to a known bug in those gcc
263       builds: see <https://sourceforge.net/p/mingw/bugs/2152/>.
264
265       Some test failures may occur if you use a command shell other than the
266       native "cmd.exe", or if you are building from a path that contains
267       spaces.  So don't do that.
268
269       If you are running the tests from a emacs shell window, you may see
270       failures in op/stat.t.  Run "gmake test-notty" in that case.
271
272       Furthermore, you should make sure that during "make test" you do not
273       have any GNU tool packages in your path: some toolkits like Unixutils
274       include some tools ("type" for instance) which override the Windows
275       ones and makes tests fail. Remove them from your path while testing to
276       avoid these errors.
277
278       To see the output of specific failing tests run the harness from the t
279       directory:
280
281         # assuming you're starting from the win32 directory
282         cd ..\win32
283         .\perl harness <list of tests>
284
285       Please report any other failures as described under "BUGS AND CAVEATS".
286
287   Installation of Perl on Windows
288       Type "gmake install" ("nmake install").  This will put the newly built
289       perl and the libraries under whatever "INST_TOP" points to in the
290       Makefile.  It will also install the pod documentation under
291       "$INST_TOP\$INST_VER\lib\pod" and HTML versions of the same under
292       "$INST_TOP\$INST_VER\lib\pod\html".
293
294       To use the Perl you just installed you will need to add a new entry to
295       your PATH environment variable: "$INST_TOP\bin", e.g.
296
297           set PATH=c:\perl\bin;%PATH%
298
299       If you opted to uncomment "INST_VER" and "INST_ARCH" in the makefile
300       then the installation structure is a little more complicated and you
301       will need to add two new PATH components instead:
302       "$INST_TOP\$INST_VER\bin" and "$INST_TOP\$INST_VER\bin\$ARCHNAME", e.g.
303
304           set PATH=c:\perl\5.6.0\bin;c:\perl\5.6.0\bin\MSWin32-x86;%PATH%
305
306   Usage Hints for Perl on Windows
307       Environment Variables
308           The installation paths that you set during the build get compiled
309           into perl, so you don't have to do anything additional to start
310           using that perl (except add its location to your PATH variable).
311
312           If you put extensions in unusual places, you can set PERL5LIB to a
313           list of paths separated by semicolons where you want perl to look
314           for libraries.  Look for descriptions of other environment
315           variables you can set in perlrun.
316
317           You can also control the shell that perl uses to run system() and
318           backtick commands via PERL5SHELL.  See perlrun.
319
320           Perl does not depend on the registry, but it can look up certain
321           default values if you choose to put them there unless disabled at
322           build time with USE_NO_REGISTRY.  On Perl process start Perl checks
323           if "HKEY_CURRENT_USER\Software\Perl" and
324           "HKEY_LOCAL_MACHINE\Software\Perl" exist.  If the keys exists, they
325           will be checked for remainder of the Perl process's run life for
326           certain entries.  Entries in "HKEY_CURRENT_USER\Software\Perl"
327           override entries in "HKEY_LOCAL_MACHINE\Software\Perl".  One or
328           more of the following entries (of type REG_SZ or REG_EXPAND_SZ) may
329           be set in the keys:
330
331            lib-$]        version-specific standard library path to add to @INC
332            lib           standard library path to add to @INC
333            sitelib-$]    version-specific site library path to add to @INC
334            sitelib       site library path to add to @INC
335            vendorlib-$]  version-specific vendor library path to add to @INC
336            vendorlib     vendor library path to add to @INC
337            PERL*         fallback for all %ENV lookups that begin with "PERL"
338
339           Note the $] in the above is not literal.  Substitute whatever
340           version of perl you want to honor that entry, e.g. 5.6.0.  Paths
341           must be separated with semicolons, as usual on Windows.
342
343       File Globbing
344           By default, perl handles file globbing using the File::Glob
345           extension, which provides portable globbing.
346
347           If you want perl to use globbing that emulates the quirks of DOS
348           filename conventions, you might want to consider using
349           File::DosGlob to override the internal glob() implementation.  See
350           File::DosGlob for details.
351
352       Using perl from the command line
353           If you are accustomed to using perl from various command-line
354           shells found in UNIX environments, you will be less than pleased
355           with what Windows offers by way of a command shell.
356
357           The crucial thing to understand about the Windows environment is
358           that the command line you type in is processed twice before Perl
359           sees it.  First, your command shell (usually CMD.EXE) preprocesses
360           the command line, to handle redirection, environment variable
361           expansion, and location of the executable to run. Then, the perl
362           executable splits the remaining command line into individual
363           arguments, using the C runtime library upon which Perl was built.
364
365           It is particularly important to note that neither the shell nor the
366           C runtime do any wildcard expansions of command-line arguments (so
367           wildcards need not be quoted).  Also, the quoting behaviours of the
368           shell and the C runtime are rudimentary at best (and may, if you
369           are using a non-standard shell, be inconsistent).  The only
370           (useful) quote character is the double quote (").  It can be used
371           to protect spaces and other special characters in arguments.
372
373           The Windows documentation describes the shell parsing rules here:
374           <https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd>
375           and the C runtime parsing rules here:
376           <https://msdn.microsoft.com/en-us/library/17w5ykft%28v=VS.100%29.aspx>.
377
378           Here are some further observations based on experiments: The C
379           runtime breaks arguments at spaces and passes them to programs in
380           argc/argv.  Double quotes can be used to prevent arguments with
381           spaces in them from being split up.  You can put a double quote in
382           an argument by escaping it with a backslash and enclosing the whole
383           argument within double quotes.  The backslash and the pair of
384           double quotes surrounding the argument will be stripped by the C
385           runtime.
386
387           The file redirection characters "<", ">", and "|" can be quoted by
388           double quotes (although there are suggestions that this may not
389           always be true).  Single quotes are not treated as quotes by the
390           shell or the C runtime, they don't get stripped by the shell (just
391           to make this type of quoting completely useless).  The caret "^"
392           has also been observed to behave as a quoting character, but this
393           appears to be a shell feature, and the caret is not stripped from
394           the command line, so Perl still sees it (and the C runtime phase
395           does not treat the caret as a quote character).
396
397           Here are some examples of usage of the "cmd" shell:
398
399           This prints two doublequotes:
400
401               perl -e "print '\"\"' "
402
403           This does the same:
404
405               perl -e "print \"\\\"\\\"\" "
406
407           This prints "bar" and writes "foo" to the file "blurch":
408
409               perl -e "print 'foo'; print STDERR 'bar'" > blurch
410
411           This prints "foo" ("bar" disappears into nowhereland):
412
413               perl -e "print 'foo'; print STDERR 'bar'" 2> nul
414
415           This prints "bar" and writes "foo" into the file "blurch":
416
417               perl -e "print 'foo'; print STDERR 'bar'" 1> blurch
418
419           This pipes "foo" to the "less" pager and prints "bar" on the
420           console:
421
422               perl -e "print 'foo'; print STDERR 'bar'" | less
423
424           This pipes "foo\nbar\n" to the less pager:
425
426               perl -le "print 'foo'; print STDERR 'bar'" 2>&1 | less
427
428           This pipes "foo" to the pager and writes "bar" in the file
429           "blurch":
430
431               perl -e "print 'foo'; print STDERR 'bar'" 2> blurch | less
432
433           Discovering the usefulness of the "command.com" shell on Windows 9x
434           is left as an exercise to the reader :)
435
436           One particularly pernicious problem with the 4NT command shell for
437           Windows is that it (nearly) always treats a % character as
438           indicating that environment variable expansion is needed.  Under
439           this shell, it is therefore important to always double any %
440           characters which you want Perl to see (for example, for hash
441           variables), even when they are quoted.
442
443       Building Extensions
444           The Comprehensive Perl Archive Network (CPAN) offers a wealth of
445           extensions, some of which require a C compiler to build.  Look in
446           <https://www.cpan.org/> for more information on CPAN.
447
448           Note that not all of the extensions available from CPAN may work in
449           the Windows environment; you should check the information at
450           <https://www.cpantesters.org/> before investing too much effort
451           into porting modules that don't readily build.
452
453           Most extensions (whether they require a C compiler or not) can be
454           built, tested and installed with the standard mantra:
455
456               perl Makefile.PL
457               $MAKE
458               $MAKE test
459               $MAKE install
460
461           where $MAKE is whatever 'make' program you have configured perl to
462           use.  Use "perl -V:make" to find out what this is.  Some extensions
463           may not provide a testsuite (so "$MAKE test" may not do anything or
464           fail), but most serious ones do.
465
466           It is important that you use a supported 'make' program, and ensure
467           Config.pm knows about it.
468
469           Note that MakeMaker actually emits makefiles with different syntax
470           depending on what 'make' it thinks you are using.  Therefore, it is
471           important that one of the following values appears in Config.pm:
472
473               make='nmake'        # MakeMaker emits nmake syntax
474               any other value     # MakeMaker emits generic make syntax
475                                       (e.g GNU make, or Perl make)
476
477           If the value doesn't match the 'make' program you want to use, edit
478           Config.pm to fix it.
479
480           If a module implements XSUBs, you will need one of the supported C
481           compilers.  You must make sure you have set up the environment for
482           the compiler for command-line compilation before running "perl
483           Makefile.PL" or any invocation of make.
484
485           If a module does not build for some reason, look carefully for why
486           it failed, and report problems to the module author.  If it looks
487           like the extension building support is at fault, report that with
488           full details of how the build failed using the GitHub issue tracker
489           at <https://github.com/Perl/perl5/issues>.
490
491       Command-line Wildcard Expansion
492           The default command shells on DOS descendant operating systems
493           (such as they are) usually do not expand wildcard arguments
494           supplied to programs.  They consider it the application's job to
495           handle that.  This is commonly achieved by linking the application
496           (in our case, perl) with startup code that the C runtime libraries
497           usually provide.  However, doing that results in incompatible perl
498           versions (since the behavior of the argv expansion code differs
499           depending on the compiler, and it is even buggy on some compilers).
500           Besides, it may be a source of frustration if you use such a perl
501           binary with an alternate shell that *does* expand wildcards.
502
503           Instead, the following solution works rather well. The nice things
504           about it are 1) you can start using it right away; 2) it is more
505           powerful, because it will do the right thing with a pattern like
506           */*/*.c; 3) you can decide whether you do/don't want to use it; and
507           4) you can extend the method to add any customizations (or even
508           entirely different kinds of wildcard expansion).
509
510            C:\> copy con c:\perl\lib\Wild.pm
511            # Wild.pm - emulate shell @ARGV expansion on shells that don't
512            use File::DosGlob;
513            @ARGV = map {
514                         my @g = File::DosGlob::glob($_) if /[*?]/;
515                         @g ? @g : $_;
516                       } @ARGV;
517            1;
518            ^Z
519            C:\> set PERL5OPT=-MWild
520            C:\> perl -le "for (@ARGV) { print }" */*/perl*.c
521            p4view/perl/perl.c
522            p4view/perl/perlio.c
523            p4view/perl/perly.c
524            perl5.005/win32/perlglob.c
525            perl5.005/win32/perllib.c
526            perl5.005/win32/perlglob.c
527            perl5.005/win32/perllib.c
528            perl5.005/win32/perlglob.c
529            perl5.005/win32/perllib.c
530
531           Note there are two distinct steps there: 1) You'll have to create
532           Wild.pm and put it in your perl lib directory. 2) You'll need to
533           set the PERL5OPT environment variable.  If you want argv expansion
534           to be the default, just set PERL5OPT in your default startup
535           environment.
536
537           If you are using the Visual C compiler, you can get the C runtime's
538           command line wildcard expansion built into perl binary.  The
539           resulting binary will always expand unquoted command lines, which
540           may not be what you want if you use a shell that does that for you.
541           The expansion done is also somewhat less powerful than the approach
542           suggested above.
543
544       Notes on 64-bit Windows
545           Windows .NET Server supports the LLP64 data model on the Intel
546           Itanium architecture.
547
548           The LLP64 data model is different from the LP64 data model that is
549           the norm on 64-bit Unix platforms.  In the former, "int" and "long"
550           are both 32-bit data types, while pointers are 64 bits wide.  In
551           addition, there is a separate 64-bit wide integral type, "__int64".
552           In contrast, the LP64 data model that is pervasive on Unix
553           platforms provides "int" as the 32-bit type, while both the "long"
554           type and pointers are of 64-bit precision.  Note that both models
555           provide for 64-bits of addressability.
556
557           64-bit Windows running on Itanium is capable of running 32-bit x86
558           binaries transparently.  This means that you could use a 32-bit
559           build of Perl on a 64-bit system.  Given this, why would one want
560           to build a 64-bit build of Perl?  Here are some reasons why you
561           would bother:
562
563           •   A 64-bit native application will run much more efficiently on
564               Itanium hardware.
565
566           •   There is no 2GB limit on process size.
567
568           •   Perl automatically provides large file support when built under
569               64-bit Windows.
570
571           •   Embedding Perl inside a 64-bit application.
572
573   Running Perl Scripts
574       Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to indicate to
575       the OS that it should execute the file using perl.  Windows has no
576       comparable means to indicate arbitrary files are executables.
577
578       Instead, all available methods to execute plain text files on Windows
579       rely on the file "extension".  There are three methods to use this to
580       execute perl scripts:
581
582       1.      There is a facility called "file extension associations".  This
583               can be manipulated via the two commands "assoc" and "ftype"
584               that come standard with Windows.  Type "ftype /?" for a
585               complete example of how to set this up for perl scripts (Say
586               what?  You thought Windows wasn't perl-ready? :).
587
588       2.      Since file associations don't work everywhere, and there are
589               reportedly bugs with file associations where it does work, the
590               old method of wrapping the perl script to make it look like a
591               regular batch file to the OS, may be used.  The install process
592               makes available the "pl2bat.bat" script which can be used to
593               wrap perl scripts into batch files.  For example:
594
595                       pl2bat foo.pl
596
597               will create the file "FOO.BAT".  Note "pl2bat" strips any .pl
598               suffix and adds a .bat suffix to the generated file.
599
600               If you use the 4DOS/NT or similar command shell, note that
601               "pl2bat" uses the "%*" variable in the generated batch file to
602               refer to all the command line arguments, so you may need to
603               make sure that construct works in batch files.  As of this
604               writing, 4DOS/NT users will need a "ParameterChar = *"
605               statement in their 4NT.INI file or will need to execute "setdos
606               /p*" in the 4DOS/NT startup file to enable this to work.
607
608       3.      Using "pl2bat" has a few problems:  the file name gets changed,
609               so scripts that rely on $0 to find what they must do may not
610               run properly; running "pl2bat" replicates the contents of the
611               original script, and so this process can be maintenance
612               intensive if the originals get updated often.  A different
613               approach that avoids both problems is possible.
614
615               A script called "runperl.bat" is available that can be copied
616               to any filename (along with the .bat suffix).  For example, if
617               you call it "foo.bat", it will run the file "foo" when it is
618               executed.  Since you can run batch files on Windows platforms
619               simply by typing the name (without the extension), this
620               effectively runs the file "foo", when you type either "foo" or
621               "foo.bat".  With this method, "foo.bat" can even be in a
622               different location than the file "foo", as long as "foo" is
623               available somewhere on the PATH.  If your scripts are on a
624               filesystem that allows symbolic links, you can even avoid
625               copying "runperl.bat".
626
627               Here's a diversion:  copy "runperl.bat" to "runperl", and type
628               "runperl".  Explain the observed behavior, or lack thereof. :)
629               Hint: .gnidnats llits er'uoy fi ,"lrepnur" eteled :tniH
630
631   Miscellaneous Things
632       A full set of HTML documentation is installed, so you should be able to
633       use it if you have a web browser installed on your system.
634
635       "perldoc" is also a useful tool for browsing information contained in
636       the documentation, especially in conjunction with a pager like "less"
637       (recent versions of which have Windows support).  You may have to set
638       the PAGER environment variable to use a specific pager.  "perldoc -f
639       foo" will print information about the perl operator "foo".
640
641       One common mistake when using this port with a GUI library like "Tk" is
642       assuming that Perl's normal behavior of opening a command-line window
643       will go away.  This isn't the case.  If you want to start a copy of
644       "perl" without opening a command-line window, use the "wperl"
645       executable built during the installation process.  Usage is exactly the
646       same as normal "perl" on Windows, except that options like "-h" don't
647       work (since they need a command-line window to print to).
648
649       If you find bugs in perl, you can report them to
650       <https://github.com/Perl/perl5/issues>.
651

BUGS AND CAVEATS

653       Norton AntiVirus interferes with the build process, particularly if set
654       to "AutoProtect, All Files, when Opened". Unlike large applications the
655       perl build process opens and modifies a lot of files. Having the
656       AntiVirus scan each and every one slows build the process
657       significantly.  Worse, with PERLIO=stdio the build process fails with
658       peculiar messages as the virus checker interacts badly with
659       miniperl.exe writing configure files (it seems to either catch file
660       part written and treat it as suspicious, or virus checker may have it
661       "locked" in a way which inhibits miniperl updating it). The build does
662       complete with
663
664          set PERLIO=perlio
665
666       but that may be just luck. Other AntiVirus software may have similar
667       issues.
668
669       A git GUI shell extension for Windows such as TortoiseGit will cause
670       the build and later "make test" to run much slower since every file is
671       checked for its git status as soon as it is created and/or modified.
672       TortoiseGit doesn't cause any test failures or build problems unlike
673       the antivirus software described above, but it does cause similar
674       slowness. It is suggested to use Task Manager to look for background
675       processes which use high CPU amounts during the building process.
676
677       Some of the built-in functions do not act exactly as documented in
678       perlfunc, and a few are not implemented at all.  To avoid surprises,
679       particularly if you have had prior exposure to Perl in other operating
680       environments or if you intend to write code that will be portable to
681       other environments, see perlport for a reasonably definitive list of
682       these differences.
683
684       Not all extensions available from CPAN may build or work properly in
685       the Windows environment.  See "Building Extensions".
686
687       Most socket() related calls are supported, but they may not behave as
688       on Unix platforms.  See perlport for the full list.
689
690       Signal handling may not behave as on Unix platforms (where it doesn't
691       exactly "behave", either :).  For instance, calling die() or exit()
692       from signal handlers will cause an exception, since most
693       implementations of signal() on Windows are severely crippled.  Thus,
694       signals may work only for simple things like setting a flag variable in
695       the handler.  Using signals under this port should currently be
696       considered unsupported.
697
698       Please report detailed descriptions of any problems and solutions that
699       you may find at <<https://github.com/Perl/perl5/issues>>, along with
700       the output produced by "perl -V".
701

ACKNOWLEDGEMENTS

703       The use of a camel with the topic of Perl is a trademark of O'Reilly
704       and Associates, Inc. Used with permission.
705

AUTHORS

707       Gary Ng <71564.1743@CompuServe.COM>
708       Gurusamy Sarathy <gsar@activestate.com>
709       Nick Ing-Simmons <nick@ing-simmons.net>
710       Jan Dubois <jand@activestate.com>
711       Steve Hay <steve.m.hay@googlemail.com>
712
713       This document is maintained by Jan Dubois.
714

SEE ALSO

716       perl
717

HISTORY

719       This port was originally contributed by Gary Ng around 5.003_24, and
720       borrowed from the Hip Communications port that was available at the
721       time.  Various people have made numerous and sundry hacks since then.
722
723       GCC/mingw32 support was added in 5.005 (Nick Ing-Simmons).
724
725       Support for PERL_OBJECT was added in 5.005 (ActiveState Tool Corp).
726
727       Support for fork() emulation was added in 5.6 (ActiveState Tool Corp).
728
729       Win9x support was added in 5.6 (Benjamin Stuhl).
730
731       Support for 64-bit Windows added in 5.8 (ActiveState Corp).
732
733       Last updated: 06 October 2021
734
735
736
737perl v5.38.2                      2023-11-30                      PERLWIN32(1)
Impressum