📄 perlwin32.1
字号:
perl510.dll at the perl toplevel, and various other extension dll'sunder the lib\eauto directory. If the build fails for any reason, makesure you have done the previous steps correctly..Sh "Testing Perl on Win32".IX Subsection "Testing Perl on Win32"Type \*(L"dmake test\*(R" (or \*(L"nmake test\*(R"). This will run most of the tests fromthe testsuite (many tests will be skipped)..PPThere should be no test failures when running under Windows \s-1NT/2000/XP\s0.Many tests \fIwill\fR fail under Windows 9x due to the inferior command shell..PPSome test failures may occur if you use a command shell other than thenative \*(L"cmd.exe\*(R", or if you are building from a path that containsspaces. So don't do that..PPIf you are running the tests from a emacs shell window, you may seefailures in op/stat.t. Run \*(L"dmake test-notty\*(R" in that case..PPIf you're using the Borland compiler, you may see a failure in op/taint.tarising from the inability to find the Borland Runtime DLLs on the systemdefault path. You will need to copy the DLLs reported by the messagesfrom where Borland chose to install it, into the Windows system directory(usually somewhere like C:\eWINNT\eSYSTEM32) and rerun the test..PPIf you're using Borland compiler versions 5.2 and below, you may run intoproblems finding the correct header files when building extensions. Forexample, building the \*(L"Tk\*(R" extension may fail because both perl and Tkcontain a header file called \*(L"patchlevel.h\*(R". The latest Borland compiler(v5.5) is free of this misbehaviour, and it even supports anoption \-VI\- for backward (bugward) compatibility for using the old Borlandsearch algorithm to locate header files..PPIf you run the tests on a \s-1FAT\s0 partition, you may see some failures for\&\f(CW\*(C`link()\*(C'\fR related tests (\fIop/write.t\fR, \fIop/stat.t\fR ...). Testing on\&\s-1NTFS\s0 avoids these errors..PPFurthermore, you should make sure that during \f(CW\*(C`make test\*(C'\fR you do nothave any \s-1GNU\s0 tool packages in your path: some toolkits like Unixutilsinclude some tools (\f(CW\*(C`type\*(C'\fR for instance) which override the Windowsones and makes tests fail. Remove them from your path while testing toavoid these errors..PPPlease report any other failures as described under \*(L"\s-1BUGS\s0 \s-1AND\s0 \s-1CAVEATS\s0\*(R"..Sh "Installation of Perl on Win32".IX Subsection "Installation of Perl on Win32"Type \*(L"dmake install\*(R" (or \*(L"nmake install\*(R"). This will put the newlybuilt perl and the libraries under whatever \f(CW\*(C`INST_TOP\*(C'\fR points to in theMakefile. It will also install the pod documentation under\&\f(CW\*(C`$INST_TOP\e$INST_VER\elib\epod\*(C'\fR and \s-1HTML\s0 versions of the same under\&\f(CW\*(C`$INST_TOP\e$INST_VER\elib\epod\ehtml\*(C'\fR..PPTo use the Perl you just installed you will need to add a new entry toyour \s-1PATH\s0 environment variable: \f(CW\*(C`$INST_TOP\ebin\*(C'\fR, e.g..PP.Vb 1\& set PATH=c:\eperl\ebin;%PATH%.Ve.PPIf you opted to uncomment \f(CW\*(C`INST_VER\*(C'\fR and \f(CW\*(C`INST_ARCH\*(C'\fR in the makefilethen the installation structure is a little more complicated and you willneed to add two new \s-1PATH\s0 components instead: \f(CW\*(C`$INST_TOP\e$INST_VER\ebin\*(C'\fR and\&\f(CW\*(C`$INST_TOP\e$INST_VER\ebin\e$ARCHNAME\*(C'\fR, e.g..PP.Vb 1\& set PATH=c:\eperl\e5.6.0\ebin;c:\eperl\e5.6.0\ebin\eMSWin32\-x86;%PATH%.Ve.Sh "Usage Hints for Perl on Win32".IX Subsection "Usage Hints for Perl on Win32".IP "Environment Variables" 4.IX Item "Environment Variables"The installation paths that you set during the build get compiledinto perl, so you don't have to do anything additional to startusing that perl (except add its location to your \s-1PATH\s0 variable)..SpIf you put extensions in unusual places, you can set \s-1PERL5LIB\s0to a list of paths separated by semicolons where you want perlto look for libraries. Look for descriptions of other environmentvariables you can set in perlrun..SpYou can also control the shell that perl uses to run \fIsystem()\fR andbacktick commands via \s-1PERL5SHELL\s0. See perlrun..SpPerl does not depend on the registry, but it can look up certain defaultvalues if you choose to put them there. Perl attempts to read entries from\&\f(CW\*(C`HKEY_CURRENT_USER\eSoftware\ePerl\*(C'\fR and \f(CW\*(C`HKEY_LOCAL_MACHINE\eSoftware\ePerl\*(C'\fR.Entries in the former override entries in the latter. One or more of thefollowing entries (of type \s-1REG_SZ\s0 or \s-1REG_EXPAND_SZ\s0) may be set:.Sp.Vb 7\& lib\-$] version\-specific standard library path to add to @INC\& lib standard library path to add to @INC\& sitelib\-$] version\-specific site library path to add to @INC\& sitelib site library path to add to @INC\& vendorlib\-$] version\-specific vendor library path to add to @INC\& vendorlib vendor library path to add to @INC\& PERL* fallback for all %ENV lookups that begin with "PERL".Ve.SpNote the \f(CW$]\fR in the above is not literal. Substitute whatever versionof perl you want to honor that entry, e.g. \f(CW5.6.0\fR. Paths must beseparated with semicolons, as usual on win32..IP "File Globbing" 4.IX Item "File Globbing"By default, perl handles file globbing using the File::Glob extension,which provides portable globbing..SpIf you want perl to use globbing that emulates the quirks of \s-1DOS\s0filename conventions, you might want to consider using File::DosGlobto override the internal \fIglob()\fR implementation. See File::DosGlob fordetails..IP "Using perl from the command line" 4.IX Item "Using perl from the command line"If you are accustomed to using perl from various command-lineshells found in \s-1UNIX\s0 environments, you will be less than pleasedwith what Windows offers by way of a command shell..SpThe crucial thing to understand about the Windows environment is thatthe command line you type in is processed twice before Perl sees it.First, your command shell (usually \s-1CMD\s0.EXE on Windows \s-1NT\s0, and\&\s-1COMMAND\s0.COM on Windows 9x) preprocesses the command line, to handleredirection, environment variable expansion, and location of theexecutable to run. Then, the perl executable splits the remainingcommand line into individual arguments, using the C runtime libraryupon which Perl was built..SpIt is particularly important to note that neither the shell nor the Cruntime do any wildcard expansions of command-line arguments (sowildcards need not be quoted). Also, the quoting behaviours of theshell and the C runtime are rudimentary at best (and may, if you areusing a non-standard shell, be inconsistent). The only (useful) quotecharacter is the double quote ("). It can be used to protect spacesand other special characters in arguments..SpThe Windows \s-1NT\s0 documentation has almost no description of how thequoting rules are implemented, but here are some general observationsbased on experiments: The C runtime breaks arguments at spaces andpasses them to programs in argc/argv. Double quotes can be used toprevent arguments with spaces in them from being split up. You canput a double quote in an argument by escaping it with a backslash andenclosing the whole argument within double quotes. The backslash andthe pair of double quotes surrounding the argument will be stripped bythe C runtime..SpThe file redirection characters \*(L"<\*(R", \*(L">\*(R", and \*(L"|\*(R" can be quoted bydouble quotes (although there are suggestions that this may not alwaysbe true). Single quotes are not treated as quotes by the shell orthe C runtime, they don't get stripped by the shell (just to makethis type of quoting completely useless). The caret \*(L"^\*(R" has alsobeen observed to behave as a quoting character, but this appearsto be a shell feature, and the caret is not stripped from the commandline, so Perl still sees it (and the C runtime phase does not treatthe caret as a quote character)..SpHere are some examples of usage of the \*(L"cmd\*(R" shell:.SpThis prints two doublequotes:.Sp.Vb 1\& perl \-e "print \*(Aq\e"\e"\*(Aq ".Ve.SpThis does the same:.Sp.Vb 1\& perl \-e "print \e"\e\e\e"\e\e\e"\e" ".Ve.SpThis prints \*(L"bar\*(R" and writes \*(L"foo\*(R" to the file \*(L"blurch\*(R":.Sp.Vb 1\& perl \-e "print \*(Aqfoo\*(Aq; print STDERR \*(Aqbar\*(Aq" > blurch.Ve.SpThis prints \*(L"foo\*(R" (\*(L"bar\*(R" disappears into nowhereland):.Sp.Vb 1\& perl \-e "print \*(Aqfoo\*(Aq; print STDERR \*(Aqbar\*(Aq" 2> nul.Ve.SpThis prints \*(L"bar\*(R" and writes \*(L"foo\*(R" into the file \*(L"blurch\*(R":.Sp.Vb 1\& perl \-e "print \*(Aqfoo\*(Aq; print STDERR \*(Aqbar\*(Aq" 1> blurch.Ve.SpThis pipes \*(L"foo\*(R" to the \*(L"less\*(R" pager and prints \*(L"bar\*(R" on the console:.Sp.Vb 1\& perl \-e "print \*(Aqfoo\*(Aq; print STDERR \*(Aqbar\*(Aq" | less.Ve.SpThis pipes \*(L"foo\enbar\en\*(R" to the less pager:.Sp.Vb 1\& perl \-le "print \*(Aqfoo\*(Aq; print STDERR \*(Aqbar\*(Aq" 2>&1 | less.Ve.SpThis pipes \*(L"foo\*(R" to the pager and writes \*(L"bar\*(R" in the file \*(L"blurch\*(R":.Sp.Vb 1\& perl \-e "print \*(Aqfoo\*(Aq; print STDERR \*(Aqbar\*(Aq" 2> blurch | less.Ve.SpDiscovering the usefulness of the \*(L"command.com\*(R" shell on Windows 9xis left as an exercise to the reader :).SpOne particularly pernicious problem with the 4NT command shell forWindows \s-1NT\s0 is that it (nearly) always treats a % character as indicatingthat environment variable expansion is needed. Under this shell, it istherefore important to always double any % characters which you wantPerl to see (for example, for hash variables), even when they arequoted..IP "Building Extensions" 4.IX Item "Building Extensions"The Comprehensive Perl Archive Network (\s-1CPAN\s0) offers a wealthof extensions, some of which require a C compiler to build.Look in http://www.cpan.org/ for more information on \s-1CPAN\s0..SpNote that not all of the extensions available from \s-1CPAN\s0 may workin the Win32 environment; you should check the information athttp://testers.cpan.org/ before investing too much effort intoporting modules that don't readily build..SpMost extensions (whether they require a C compiler or not) canbe built, tested and installed with the standard mantra:.Sp.Vb 4\& perl Makefile.PL\& $MAKE\& $MAKE test\& $MAKE install.Ve.Spwhere \f(CW$MAKE\fR is whatever 'make' program you have configured perl touse. Use \*(L"perl \-V:make\*(R" to find out what this is. Some extensionsmay not provide a testsuite (so \*(L"$MAKE test\*(R" may not do anything orfail), but most serious ones do..SpIt is important that you use a supported 'make' program, andensure Config.pm knows about it. If you don't have nmake, you caneither get dmake from the location mentioned earlier or get anold version of nmake reportedly available from:.Sp.Vb 1\& http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN\-US/nmake15.exe.Ve.SpAnother option is to use the make written in Perl, available from\&\s-1CPAN\s0..Sp.Vb 1\& http://www.cpan.org/modules/by\-module/Make/.Ve.SpYou may also use dmake. See \*(L"Make\*(R" above on how to get it..SpNote that MakeMaker actually emits makefiles with different syntaxdepending on what 'make' it thinks you are using. Therefore, it isimportant that one of the following values appears in Config.pm:.Sp.Vb 4\& make=\*(Aqnmake\*(Aq # MakeMaker emits nmake syntax\& make=\*(Aqdmake\*(Aq # MakeMaker emits dmake syntax\& any other value # MakeMaker emits generic make syntax\& (e.g GNU make, or Perl make).Ve.SpIf the value doesn't match the 'make' program you want to use,edit Config.pm to fix it..SpIf a module implements XSUBs, you will need one of the supportedC compilers. You must make sure you have set up the environment forthe compiler for command-line compilation..SpIf a module does not build for some reason, look carefully forwhy it failed, and report problems to the module author. Ifit looks like the extension building support is at fault, reportthat with full details of how the build failed using the perlbugutility..IP "Command-line Wildcard Expansion" 4.IX Item "Command-line Wildcard Expansion"The default command shells on \s-1DOS\s0 descendant operating systems (suchas they are) usually do not expand wildcard arguments supplied to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -