Perl is a scripting language widely used for system administration and programming on the World Wide Web. It originated in the UNIX community and has a strong UNIX slant, but is still very useful for Win32 platforms. perl (small 'p') is the program used to interpret the Perl language.
To get more information about Perl, check out these WWW URLs:
There are several good books about Perl; consult your local technical bookstore. Two in particular to consider are _Programming_Perl_, 2nd Edition, by Larry Wall, Tom Christiansen and Randal L. Schwartz (O'Reilly & Associates, 1996) and _Learning_Perl_, by Randal L. Schwartz (O'Reilly & Associates, 1993). These are referred to by Perl enthusiasts as "the Camel book" and "the Llama book", respectively. The nicknames come from the pictures on the front covers.
If you are new to Perl, and there are any terms mentioned in this FAQ
that you don't get, try one of the above resources.
The main Perl interpreter available for the Win32 platform is Perl for
Win32. It was developed by ActiveWare, Inc. (originally Hip
Communications) for Microsoft Corporation for inclusion in the Windows
NT Resource Kit. It has since taken on a life of its own. When people
talk about "Perl for Win32", it is this package that they mean.
The Perl for Win32 package includes perl, PerlIS, and several
Win32-specific modules developed by ActiveWare.
A beta version of Perl for Win32, which is at the perl 5.003 level,
is also available. See question 1.13.
Another implementation is the perl port in the MKS Toolkit from
Mortice Kerns Systems, Inc. (http://www.mks.com/). This is a package
that includes numerous other UNIX-originated tools.
Another version is available compiled for OpenNT for Microsoft
Windows NT (http://www.softway.com/OpenNT/tw/contrib.html). OpenNT is a
replacement for the POSIX subsystem of Windows NT, and is produced by
Softway Systems, Inc. You'll have to have OpenNT to run this version.
[Any other implementations that should be mentioned here? - ESP]
The standard perl distribution is mainly geared for UNIX systems. The
configuration scripts are in UNIX shell language. It is therefore not
a simple task to build perl from the standard distribution.
However, it has been done. Karl Martin Syring has built perl with
the GNU-Win32 development system. His port is available at:
http://www.edv.agrar.tu-muenchen.de/~syring/gnu-win32/perl.zip
To build this, you'll need GNU-Win32, which is available from Cygnus
Support (http://www.cygnus.com/misc/gnu-win32).
Gary Ng has ported perl to be compiled with Microsoft Visual C++.
His port is available at this address:
http://www.endcontsw.com/pub/perl_win32.zip
To build it, unzip the distribution file into a win32 subdirectory
of your perl directory (from the standard distribution -- like the
os2 subdirectory).
The Perl for Win32 package is available as a ZIP archive by anonymous
FTP from ActiveWare and from CPAN, the Comprehensive Perl Archive
Network.
To download from ActiveWare, look in this directory:
ftp://ftp.activeware.com/ntperl/perl5.001m/CurrentBuild/
There are 4 distribution packages: one for Intel x86 machines, one for
DEC Alpha machines, one for PowerPC machines, and one source code
package. These packages are named XXX-i86.zip, XXX-Alp.zip, XXX-Ppc.zip,
and XXX-src.zip, respectively, where XXX is the current build number.
The current build number is 110.
To download files from CPAN, go to the following URL:
http://www.perl.com/CPAN/ports/win32/Perl5/perl5.001m/CurrentBuild/
Note that this will automatically redirect you to your nearest CPAN
mirror site.
Because the Perl for Win32 package contains long file names (LFNs),
normal zip file handlers like PKZip will not open them correctly. [Does
the newest version of PKZip handle LFNs correctly? -ESP] You need to get
a zip file opener that can work with LFNs, such as:
To extract the archive, make a new directory on your hard drive that
will become your new perl directory ("C:\Program Files\perl5" and
"C:\perl5" are good candidates). Extract the archive to that directory,
making sure that directory names are expanded from the archive (this is
crucial!). See the documentation for your unzipper for details.
The source code package includes make files for Visual C++ versions 2.x
and 4.x. The following instructions are for Visual C++ 4.x. [Does anyone
have instructions for VC++ 2.x? How about other Win32 C++ compilers?
-ESP]
The source distribution only includes Intel targets. If you're building
for another platform, like DEC Alpha, you may have to fiddle with the
build settings to get them to work. [Anyone done this? -ESP]
First, make sure you unzipped the archive correctly into the destination
directory. Then, open the perl100.mdp project file in the dll-src
subdirectory of your perl directory with Microsoft Developers Studio.
Build the "perl100 - Win32 Perl Intel DLL Release" target (Go have some
lunch -- this will take a while). You'll end up with a perl100.dll file
in your ntt subdirectory of your perl directory.
Now, open the perl.mdp project file in the exe-src subdirectory of your
perl directory. Build the "perl - Win32 Perl Intel Release" target. You
also have to build the "perl - Win32 PerlGlob Intel Release" target.
These will produce perl.exe and perlglob.exe, respectively, in your ntt
directory.
Optionally, you can build the extension files that come with the source
distribution. These include:
Note that the extensions look for perl100.lib in the dll-src\Release
directory, which by default doesn't exist. You can either create the
directory and copy the lib file there, or go through the build settings
for the extensions and set them to point to the proper directory,
dll-src\LibRel.
Building the extensions will put the extension binaries (.pll files) in
the proper place in the Lib subdirectory.
The last step is running install.bat, a perl program masquerading as a
batch file found in your perl directory. Running install.bat will
register the perl program and PerlIS with your system, as well as copy
the binary files from the ntt subdirectory to the bin subdirectory.
If you installed in a directory with long file names (like
"C:\Program Files\perl5"), you may want to change directory to the DOS
version of your directory (like "cd C:\PROGRA~1\perl5") before running
install.bat. This ensures that you get only readable paths in your
registry, and could avoid some annoying errors.
Installing Perl for Win32 adds the following keys to your registry, if
they don't already exist:
The BIN and PRIVLIB values are probably used in the perl interpreter to
find files for loading. The purpose of the HTML-DOCS value is unclear.
Installing also adds your perl binary path to the PATH variable for your
system, as well as "." (current directory), for historical reasons.
Also, if you have Microsoft Internet Information Server (IIS) installed,
install.bat will associate an extension of your choosing (.pl is the
default) with PerlIS in the IIS script mapping registry key,
HKEY_LOCAL_MACHINE\System\Services\W3SVC\Parameters\Script Map. See IIS
documentation for more info on the script map.
You are not able to uninstall Perl for Win32 from the Add/Remove
Programs section of the Control Panel (if you have such a section).
In your original perl directory, there is a file called uninstall.bat.
Use this to clear out the registry settings created by install.bat.
uninstall.bat does not delete your Perl for Win32 files for you. You can
do this manually with Explorer, File Manager, or
"del [perl directory]\*.* /S /Q", where [perl directory] is your perl
directory.
Active Scripting is a new technology put out by Microsoft Corporation to
allow code embedded in HTML pages to run on WWW clients or servers. It
is designed to be language neutral, so that you can write Active Scripts
in Visual Basic, JavaScript, Python, or, theoretically, Perl.
Yes. On December 4, 1996, ActiveWare released a beta version of
PerlScript, an ActiveScripting engine for the Perl language.
ftp://ftp.activeware.com/beta/PlSEi302.exe
or on CPAN at
http://www.perl.com/CPAN/ports/win32/Perl5/beta/PlSEi302.exe
You'll also need to download either the Perl for Win32 5.003 binary or
source format package in the same directory (see question 1.13).
There's no documentation to speak of, but there are several examples.
ActiveScripting works a lot like OLE Automation, so if you review
that documentation, plus the ActiveScripting documentation, you should
be able to get along.
Although it's possible to program in batch language or with QBASIC (a
16-bit BASIC interpreter that comes with Windows 95 and Windows NT),
serious programmers will probably prefer one of the following other
options:
Awk and UNIX shell languages are available from in several UNIX-to-NT
packages (see question 4.7).
[Any others? -ESP]
On December 4, 1996, ActiveWare released a beta version of Perl for Win32
at the 5.003 level. It corrects many of the flaws of the 110 build at the
5.001m level. It's available at
ftp://ftp.activeware.com/Perl-Win32/beta/
or on CPAN at
http://www.perl.com/CPAN/ports/win32/Perl5/beta/
There are four beta packages:
Neither PerlIS (see question 2.2) or any of the RISC processor
distributions can be found here.
Many of the answers in this FAQ do not apply to the beta version.
Perl for Win32 is a Win32 command-line program. It expects to be run
from the command line, not from Explorer.
If you want to run a Perl script, write the script out using a text
editor like Notepad. A good starter program is:
Save the program to a file on your hard disk (such as
"C:\temp\hello.pl"). Now, start a command prompt window (sometimes
erroneously called a "DOS window"), and type the following line at
the command prompt:
This should print out the words "Hello, World!" on the screen.
You may have to do some fiddling with the PATH environment variable,
or specify the full path name to perl.exe, in order for this to work.
perl.exe has a lot of nifty command-line arguments that can make your
work a lot easier. See the perlrun documentation page for details.
To answer the original question about what's happening when you start
perl from an Explorer window rather than a command-line window: starting
from Explorer is roughly the same as starting perl without any command
line arguments. When perl is started without a script file specified
on the command line, it expects to receive a Perl program as standard
input, i.e., from the keyboard.
The blinking cursor means perl is waiting for your input. You can
actually type in a Perl program from the keyboard, and then let perl
know to execute it by typing the Ctrl-Z key, which is the end-of-file
marker on Windows systems.
PerlIS.dll is a special interpreter for Perl (see question 2.2). Because
setting PerlIS up for Microsoft Internet Information Server (IIS) is such
a pain in the keister, install.bat will do it for you automagically.
However, if you don't use IIS on the machine you're installing Perl for
Win32 on, you should answer "no" when you're asked. A lot of people confuse
"PerlIS.dll" that the message asks about with Perl for Win32 in general.
Thus the problem.
If you get this error, ignore it. Perl programs should run just fine. If
you're the kind of chucklehead who won't sleep knowing that there was an
error during the installation, just run uninstall.bat, then run install.bat
again, and answer "no" instead of "yes". Feel better?
If you want to use PerlIS.dll with another ISAPI-enabled Web browser, you'll
have to set that up by hand. install.bat won't do it for you.
1.2. What Perl interpreters are available for the Win32 platform?
1.3. Can I build perl myself from the standard distribution source code?
1.4. Where is the Perl for Win32 interpreter available?
1.5. How do I unzip the Perl for Win32 package?
1.6. How do I build Perl for Win32 from the source code package?
1.7. OK, I've got it downloaded, unzipped, and optionally built. Now what?
1.8. What does installing do to my registry?
1.9. How do I uninstall Perl for Win32?
1.10. What is ActiveScripting?
1.11. Is there an ActiveScripting version of Perl available?
1.12. What other scripting languages are available for Win32 platforms?
1.13. Where's Perl for Win32 5.003?
1.14. When I double-click on the "perl.exe" icon in Explorer, I get an empty DOS window with a blinking cursor. What gives?
print "Hello, World!\n";
C:\> perl c:\temp\hello.pl
1.15. When I install Perl for Win32, it says I don't have Internet Information Server, and asks if it should still install PerlIS.dll.
When I say yes, it says there was an error. Why?
Популярность: 10, Last-modified: Mon, 24 Mar 1997 05:44:13 GmT