⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 perlwin32.pod

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 POD
📖 第 1 页 / 共 3 页
字号:
You also need dmake.  See L</"Make"> above on how to get it.

=item MinGW release 1 with gcc

The MinGW-1.1 bundle contains gcc-2.95.3.

Make sure you install the binaries that work with MSVCRT.DLL as indicated
in the README for the GCC bundle.  You may need to set up a few environment
variables (usually ran from a batch file).

There are a couple of problems with the version of gcc-2.95.2-msvcrt.exe
released 7 November 1999:

=over

=item *

It left out a fix for certain command line quotes.  To fix this, be sure
to download and install the file fixes/quote-fix-msvcrt.exe from the above
ftp location.

=item *

The definition of the fpos_t type in stdio.h may be wrong.  If your
stdio.h has this problem, you will see an exception when running the
test t/lib/io_xs.t.  To fix this, change the typedef for fpos_t from
"long" to "long long" in the file i386-mingw32msvc/include/stdio.h,
and rebuild.

=back

A potentially simpler to install (but probably soon-to-be-outdated) bundle
of the above package with the mentioned fixes already applied is available
here:

    http://downloads.ActiveState.com/pub/staff/gsar/gcc-2.95.2-msvcrt.zip
    ftp://ftp.ActiveState.com/pub/staff/gsar/gcc-2.95.2-msvcrt.zip

=back

=head2 Building

=over 4

=item *

Make sure you are in the "win32" subdirectory under the perl toplevel.
This directory contains a "Makefile" that will work with
versions of nmake that come with Visual C++ or the Platform SDK, and
a dmake "makefile.mk" that will work for all supported compilers.  The
defaults in the dmake makefile are setup to build using MinGW/gcc.

=item *

Edit the makefile.mk (or Makefile, if you're using nmake) and change
the values of INST_DRV and INST_TOP.   You can also enable various
build flags.  These are explained in the makefiles.

Note that it is generally not a good idea to try to build a perl with
INST_DRV and INST_TOP set to a path that already exists from a previous
build.  In particular, this may cause problems with the
lib/ExtUtils/t/Embed.t test, which attempts to build a test program and
may end up building against the installed perl's lib/CORE directory rather
than the one being tested.

You will have to make sure that CCTYPE is set correctly and that
CCHOME points to wherever you installed your compiler.

The default value for CCHOME in the makefiles for Visual C++
may not be correct for some versions.  Make sure the default exists
and is valid.

You may also need to comment out the C<DELAYLOAD = ...> line in the
Makefile if you're using VC++ 6.0 without the latest service pack and
the linker reports an internal error.

If you are using VC++ 4.2 or earlier then you'll have to change the /EHsc
option in the CXX_FLAG macro to the equivalent /GX option.

If you have either the source or a library that contains des_fcrypt(),
enable the appropriate option in the makefile.  A ready-to-use version
of fcrypt.c, based on the version originally written by Eric Young at
ftp://ftp.funet.fi/pub/crypt/mirrors/dsi/libdes/, is bundled with the
distribution and CRYPT_SRC is set to use it.
Alternatively, if you have built a library that contains des_fcrypt(),
you can set CRYPT_LIB to point to the library name.
Perl will also build without des_fcrypt(), but the crypt() builtin will
fail at run time.

If you want build some core extensions statically into perl's dll, specify
them in the STATIC_EXT macro.

Be sure to read the instructions near the top of the makefiles carefully.

=item *

Type "dmake" (or "nmake" if you are using that make).

This should build everything.  Specifically, it will create perl.exe,
perl510.dll at the perl toplevel, and various other extension dll's
under the lib\auto directory.  If the build fails for any reason, make
sure you have done the previous steps correctly.

=back

=head2 Testing Perl on Win32

Type "dmake test" (or "nmake test").  This will run most of the tests from
the testsuite (many tests will be skipped).

There should be no test failures when running under Windows NT/2000/XP.
Many tests I<will> fail under Windows 9x due to the inferior command shell.

Some test failures may occur if you use a command shell other than the
native "cmd.exe", or if you are building from a path that contains
spaces.  So don't do that.

If you are running the tests from a emacs shell window, you may see
failures in op/stat.t.  Run "dmake test-notty" in that case.

If you're using the Borland compiler, you may see a failure in op/taint.t
arising from the inability to find the Borland Runtime DLLs on the system
default path.  You will need to copy the DLLs reported by the messages
from where Borland chose to install it, into the Windows system directory
(usually somewhere like C:\WINNT\SYSTEM32) and rerun the test.

If you're using Borland compiler versions 5.2 and below, you may run into
problems finding the correct header files when building extensions.  For
example, building the "Tk" extension may fail because both perl and Tk
contain a header file called "patchlevel.h".  The latest Borland compiler
(v5.5) is free of this misbehaviour, and it even supports an
option -VI- for backward (bugward) compatibility for using the old Borland
search algorithm  to locate header files.

If you run the tests on a FAT partition, you may see some failures for
C<link()> related tests (I<op/write.t>, I<op/stat.t> ...). Testing on
NTFS avoids these errors.

Furthermore, you should make sure that during C<make test> you do not
have any GNU tool packages in your path: some toolkits like Unixutils
include some tools (C<type> for instance) which override the Windows
ones and makes tests fail. Remove them from your path while testing to
avoid these errors.

Please report any other failures as described under L<BUGS AND CAVEATS>.

=head2 Installation of Perl on Win32

Type "dmake install" (or "nmake install").  This will put the newly
built perl and the libraries under whatever C<INST_TOP> points to in the
Makefile.  It will also install the pod documentation under
C<$INST_TOP\$INST_VER\lib\pod> and HTML versions of the same under
C<$INST_TOP\$INST_VER\lib\pod\html>.

To use the Perl you just installed you will need to add a new entry to
your PATH environment variable: C<$INST_TOP\bin>, e.g.

    set PATH=c:\perl\bin;%PATH%

If you opted to uncomment C<INST_VER> and C<INST_ARCH> in the makefile
then the installation structure is a little more complicated and you will
need to add two new PATH components instead: C<$INST_TOP\$INST_VER\bin> and
C<$INST_TOP\$INST_VER\bin\$ARCHNAME>, e.g.

    set PATH=c:\perl\5.6.0\bin;c:\perl\5.6.0\bin\MSWin32-x86;%PATH%

=head2 Usage Hints for Perl on Win32

=over 4

=item Environment Variables

The installation paths that you set during the build get compiled
into perl, so you don't have to do anything additional to start
using that perl (except add its location to your PATH variable).

If you put extensions in unusual places, you can set PERL5LIB
to a list of paths separated by semicolons where you want perl
to look for libraries.  Look for descriptions of other environment
variables you can set in L<perlrun>.

You can also control the shell that perl uses to run system() and
backtick commands via PERL5SHELL.  See L<perlrun>.

Perl does not depend on the registry, but it can look up certain default
values if you choose to put them there.  Perl attempts to read entries from
C<HKEY_CURRENT_USER\Software\Perl> and C<HKEY_LOCAL_MACHINE\Software\Perl>.
Entries in the former override entries in the latter.  One or more of the
following entries (of type REG_SZ or REG_EXPAND_SZ) may be set:

    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"

Note the C<$]> in the above is not literal.  Substitute whatever version
of perl you want to honor that entry, e.g. C<5.6.0>.  Paths must be
separated with semicolons, as usual on win32.

=item File Globbing

By default, perl handles file globbing using the File::Glob extension,
which provides portable globbing.

If you want perl to use globbing that emulates the quirks of DOS
filename conventions, you might want to consider using File::DosGlob
to override the internal glob() implementation.  See L<File::DosGlob> for
details.

=item Using perl from the command line

If you are accustomed to using perl from various command-line
shells found in UNIX environments, you will be less than pleased
with what Windows offers by way of a command shell.

The crucial thing to understand about the Windows environment is that
the command line you type in is processed twice before Perl sees it.
First, your command shell (usually CMD.EXE on Windows NT, and
COMMAND.COM on Windows 9x) preprocesses the command line, to handle
redirection, environment variable expansion, and location of the
executable to run. Then, the perl executable splits the remaining
command line into individual arguments, using the C runtime library
upon which Perl was built.

It is particularly important to note that neither the shell nor the C
runtime do any wildcard expansions of command-line arguments (so
wildcards need not be quoted).  Also, the quoting behaviours of the
shell and the C runtime are rudimentary at best (and may, if you are
using a non-standard shell, be inconsistent).  The only (useful) quote
character is the double quote (").  It can be used to protect spaces
and other special characters in arguments.

The Windows NT documentation has almost no description of how the
quoting rules are implemented, but here are some general observations
based on experiments: The C runtime breaks arguments at spaces and
passes them to programs in argc/argv.  Double quotes can be used to
prevent arguments with spaces in them from being split up.  You can
put a double quote in an argument by escaping it with a backslash and
enclosing the whole argument within double quotes.  The backslash and
the pair of double quotes surrounding the argument will be stripped by
the C runtime.

The file redirection characters "E<lt>", "E<gt>", and "|" can be quoted by
double quotes (although there are suggestions that this may not always
be true).  Single quotes are not treated as quotes by the shell or
the C runtime, they don't get stripped by the shell (just to make
this type of quoting completely useless).  The caret "^" has also
been observed to behave as a quoting character, but this appears
to be a shell feature, and the caret is not stripped from the command
line, so Perl still sees it (and the C runtime phase does not treat
the caret as a quote character).

Here are some examples of usage of the "cmd" shell:

This prints two doublequotes:

    perl -e "print '\"\"' "

This does the same:

    perl -e "print \"\\\"\\\"\" "

This prints "bar" and writes "foo" to the file "blurch":

    perl -e "print 'foo'; print STDERR 'bar'" > blurch

This prints "foo" ("bar" disappears into nowhereland):

    perl -e "print 'foo'; print STDERR 'bar'" 2> nul

This prints "bar" and writes "foo" into the file "blurch":

    perl -e "print 'foo'; print STDERR 'bar'" 1> blurch

This pipes "foo" to the "less" pager and prints "bar" on the console:

    perl -e "print 'foo'; print STDERR 'bar'" | less

This pipes "foo\nbar\n" to the less pager:

    perl -le "print 'foo'; print STDERR 'bar'" 2>&1 | less

This pipes "foo" to the pager and writes "bar" in the file "blurch":

    perl -e "print 'foo'; print STDERR 'bar'" 2> blurch | less


Discovering the usefulness of the "command.com" shell on Windows 9x
is left as an exercise to the reader :)

One particularly pernicious problem with the 4NT command shell for
Windows NT is that it (nearly) always treats a % character as indicating
that environment variable expansion is needed.  Under this shell, it is
therefore important to always double any % characters which you want
Perl to see (for example, for hash variables), even when they are
quoted.

=item Building Extensions

The Comprehensive Perl Archive Network (CPAN) offers a wealth
of extensions, some of which require a C compiler to build.
Look in http://www.cpan.org/ for more information on CPAN.

Note that not all of the extensions available from CPAN may work
in the Win32 environment; you should check the information at
http://testers.cpan.org/ before investing too much effort into
porting modules that don't readily build.

Most extensions (whether they require a C compiler or not) can
be built, tested and installed with the standard mantra:

    perl Makefile.PL
    $MAKE
    $MAKE test
    $MAKE install

where $MAKE is whatever 'make' program you have configured perl to
use.  Use "perl -V:make" to find out what this is.  Some extensions
may not provide a testsuite (so "$MAKE test" may not do anything or
fail), but most serious ones do.

It is important that you use a supported 'make' program, and
ensure Config.pm knows about it.  If you don't have nmake, you can
either get dmake from the location mentioned earlier or get an
old version of nmake reportedly available from:

 http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/nmake15.exe

Another option is to use the make written in Perl, available from
CPAN.

    http://www.cpan.org/modules/by-module/Make/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -