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

BUGS AND CAVEATS

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

ACKNOWLEDGEMENTS

698       The use of a camel with the topic of Perl is a trademark of O'Reilly
699       and Associates, Inc. Used with permission.
700

AUTHORS

702       Gary Ng <71564.1743@CompuServe.COM>
703       Gurusamy Sarathy <gsar@activestate.com>
704       Nick Ing-Simmons <nick@ing-simmons.net>
705       Jan Dubois <jand@activestate.com>
706       Steve Hay <steve.m.hay@googlemail.com>
707
708       This document is maintained by Jan Dubois.
709

SEE ALSO

711       perl
712

HISTORY

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