This is the most efficient way I know
of to download and install the Windows 95 / NT
perl executable:
1) Click here:
http://www.perl.com/CPAN/ports/win95/Standard/x86/ The PERL.COM site
automatically re-directs you to the next available CPAN site near you.
(Pretty cool huh?!) (Go ahead and
click it now; it opens in a new window.)
2) Download the
correct file:
Once you have been re-directed to the FTP site, you should already be in
the CPAN// or pub/CPAN// or something...
ports/win95/Standard/x86/ directory. Now look
for the file: perl5.00402-bindist04-bc.tar.gz 11-Aug-1997
00:00 4.9M (5,134,365 bytes)
IF you don't have the latest copy of
WinZip which can read both .tar and .gz
files, you may need to download the larger .ZIP file by the same name:
perl5.00402-bindist04-bc.zip 12-Nov-1997 00:00
5.9M (6,176,370 bytes)
This is the Win32 compiled version of the perl distribution.
Please don't let the size put you off! There are many support files and
loads of documentation that you may never use. I believe they're all
required to be in any perl distribution. The parts you actually need to RUN
perl on a PC are about 1Mb, but everything else brings the install size up
to about 22Mb.
3) Extract the
files to your ROOT DIRECTORY:
If you are using the new WinZip on the *.tar.gz file, you will see a
dialog box like this before WinZip opens the package:
Make sure you extract all of the files from the archive (*.tar or
*.zip) into their proper folders! (Allowing the
"directory tree" in the archive to be created on your drive.)
WinZip has a check box labeled "Use
folder names" in its "Extract" dialog box that
must be checked. NOTE: Do
not change anything after the
files are created! This is only the initial step of the installation
process. The final name of your perl folder will be changed
when you run the install program.
( The extraction itself takes almost 5 min. on a 100MHz PC since there are
over 2200 files here. Again, don't let the amount of "support
files" concern you. Perl itself is actually quite easy to begin using
with any of the online tutorials or introductions to the language; see the
links above for a free tutorial or book.)
4) Begin the Install:
Please review this summary before starting the process:
Perl Install Instructions.
In C:\ (or whatever your ROOT directory is), find the newly created
perl5.00402-bindist04-bc folder and execute the install.bat
file while at a DOS prompt. ( You may wish to review/learn how to use the
features of a DOS-window in Windows at
this time.)
Except for ONE question (about a compiler), the rest of the install
process can be summarized in one phrase: `Keep pressing the ENTER key!'
The first question the install file asks is:
Where would you like Perl to be
installed? [c:\perl]
Just press the ENTER key for the default, then you'll see:
Ok to create `c:\perl'? [y]
Press the ENTER key again. It then asks:
Do you have a C compiler? [y]
Unless
you're already a professional programmer, you'll probably need to
answer no (press the
'n' key) to this one. If you have the BC++
5.02 compiler (especially if you are installing perl on a
WindowsNT machine) it wouldn't hurt to add its location to perl's
configuration; this does not affect the install process.
Other questions and comments include: Install HTML documentation? (needs 4.5MB) [y]
Where should HTML be installed?
[c:\perl\html]
Just keep pressing the ENTER key to each of these questions...
The install then shoots out a paragraph that may be difficult to
understand, but even if you do not have a web server installed on your
PC, it's probably best to accept the default in the next line:
Root of the perl HTML tree?
[/c|/perl/html] I had problems
with the hyperlinks in the HTML conversion
when I used the string `c:\perl\html.'
So, just press the ENTER key again! (Accepting the
`/c|/perl/html' default.)
The install program then summarizes what it's about to do:
We're now ready to copy files.
Perl will be installed in `c:\perl'.
HTML documentation will be installed in `c:\perl\html'.
Document URLs will begin at `/c|/perl/html'.
Proceed? [y] Press the ENTER key, and take a short break
... (On my 100 MHz Pentium machine, it took just 1 minute to copy the
1,207 program and module files and only 4 more minutes to do all of the
POD to HTML conversions.) Click here for a listing of the perl install program's output lines
(Opens in a new window).
On the last screen, the install program states (in part): "
You can do this in the `Environment'
tab of the `System' Control Panel..."
This is true ONLY in Windows NT -- there is NO "Environment
Tab" in Windows95!
You must add the location of PERL.EXE to your `PATH ':
If you asked for things to be installed under `c:\perl', then add
" c:\perl\bin " to the " PATH= " statement in your
AUTOEXEC.BAT file. (This change to your
AUTOEXEC.BAT file will require you to reboot before it takes effect
under Windows95.)
5) Checking and
Testing your new perl installation ("Standard" or
"ActiveState" versions):
Quick Check:
After you've rebooted your computer, open an MS-DOS Prompt (or COMMAND.COM)
window. You'll probably be in the Windows folder (C:\WINDOWS>) which is
just fine for this test. Type in: perl -v (and press the
ENTER key). Here's what you should see:
This is perl, version 5.004_02
Copyright 1987-1997, Larry Wall
Perl may be copied only under the terms of either the Artistic License or
the GNU General Public License, which may be found in the Perl 5.0 source
kit.
(Or, for those with the ActiveState version, you'll see something
similar to this):
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Binary build 629 provided by ActiveState Tool Corp.
http://www.ActiveState.com Built 12:27:04 Aug 20 2001
(plus the license notes, etc.)
If you see the words, Bad command or file name,
instead, then type: path (press ENTER)
and make sure that C:\PERL\BIN
is somewhere in your PATH=
statement. After correcting any errors in your
AUTOEXEC.BAT file, you'll have to reboot again
under Win95! (For WinNT users: change this in your SYSTEM Control Panel
under the "Environment" TAB.)
Test 1.
At the DOS prompt, type in: perldoc ( press the ENTER
key). You should see something like this:
Usage: PERLDOC.bat [-h] [-v] [-t] [-u] [-m] [-l]
PageName|ModuleName|ProgramName PERLDOC.bat -f PerlFunc
We suggest you use "perldoc perldoc" to get aquainted with the system.
(The ActiveState version adds the switches
[-F] [-X] and
perldoc.bat -q FAQKeywords to the
functionality of perldoc.bat.)
Although perldoc is a DOS batch file in the
C:\perl\bin folder, most of it is written in Perl. Yes, Perl script
can be embedded within DOS batch files by placing it where DOS never sees
it and making a "call" to the perl executable with a number
of command-line switches. [ Entering perl -x -S perldoc should
produce the same exact output you saw above. DOS batch files like this one
make things a lot easier for you.]
(Unfortunately, perldoc.bat
does not always operate as
intended under Windows95/NT as far as displaying the information on
your screen one page at a time! This is especially true when using the -
f switch! Here's my solution to this problem for a Windows95
install: Batch file and perl script for proper
paging of perldoc.bat output.)
Test 2.
At the DOS prompt, enter: perldoc perldoc
The following is just the beginning of the documentation you'll see:
NAME
perldoc - Look up Perl documentation in pod format.
SYNOPSIS
perldoc [-h] [-v] [-t] [-u] [-m] [-l] PageName|ModuleName|ProgramName
perldoc -f BuiltinFunction
Remember that you must use the -f switch in order to extract
information about a function from the perlfunc documentation
page.
Test 3: Let's run a little perl script !
Open NOTEPAD (or some other text editor) and copy the following lines into
it:
#!perl
# A VERY simple Perl script
print " \n\n Hello from The Programming Republic of Perl ! \n ";
exit;
Now save (or rename) the file as: test3.pl If you're
running Windows95, it's best to save it as:
c:\windows\test3.pl (since your MS-DOS prompt opens at
C:\WINDOWS>).
Although the first
line, #!perl
, is NOT necessary to run a perl
script under Windows 95/98/NT, it is good programming practice
to make your perl scripts as portable (able to run on many
different systems) as possible. On many UNIX-type systems, this line is
written as:
#!/usr/local/bin/perl and referred to as the
"she-bang" line; possibly helpful in remembering that
the "bang" character (!) follows the # character. This is a
special line (not a comment) that tells those systems which understand it
where they can find the perl executable.
Windows95/NT use the PATH statement and their Registry files
(containing " file associations" ) instead. The perl
executable will try to run any file you ask it to as a perl script, but it's
also a good practice to use the .pl extension.
Let's execute the script: Open a DOS (Command prompt) window, and
enter the following at the prompt: perl test3.pl
Your screen should look similar to this after it runs:
If, instead, you saw
something like this:
Then make sure that the file was NOT
saved as test3.pl.txt (your
text editor may have been set to save files as "Text Documents"
only instead of "All Files" ). Also check that
test3.pl is actually located in the folder you believed you saved it to (you
may need to cd to the correct folder).
If there was some other kind of error, try running the script with the
-w switch. This switch turns on &quoot;warnings" which can be VERY
helpful when you start writing Perl scripts of your own! ( Under the
"BUGS" section of perldoc perl, you'll find the humorous
comment: "The -w switch is not mandatory" as a reminder of just
how important this can be at times! )
Delete the file test3.pl when you're through using it.
Test 4: Testing some perl file-functions!
Most browsers can either save a file as anything you wish (Netscape), or at
least as a text file (MS-IE). The following link opens a Perl script (saved
as a text file) in a new window. Try saving the file directly as
test4.pl in your c:\windows folder as we did above (or
whichever folder is the easiest for you to access from a DOS prompt). If
you must save it as a text file, then rename it to test4.pl:
Standard I/O and file functions test
script. (First take a few minutes to read the comment lines inside of my
perl script and try to picture what the program will do.)
OK, pop up your DOS window again, and execute the script by entering:
perl test4.pl
This script will quickly test the ability of your perl installation to
create a new file, write to it, append to it, read from it and finally
delete it. In the process, it also tests the standard I/O (sending data to
your screen and reading data in from the keyboard).
If you run the script with the -w switch, you'll see the warning:
Name "main::TTEST" used only once: possible typo at test4.pl line 58.
This is because I fully expect the file open function (which uses the
"file handle" TTEST) to fail here. If it didn't, that would mean
that there was an error in deleting ("unlinking") the temporary
file!
You might like
to check out my: Free Windows 95/98/NT Tools page here.
|