Perl Programming   «Prev  Next»
Lesson 4Installing Perl on your Windows system
ObjectiveConfigure your system for perl and then install it.

Installing Perl on your Windows System

Once you have downloaded the appropriate Perl distribution for your system, you must compile and/or install it on your system. The procedure for installing Perl on non-Unix systems (called foreign ports by the Perl community) is going to be very different from the procedure for installing Perl on Unix systems.
The best source for instructions will be the documentation that came with your Perl distribution. You can typically find precompiled binaries for most major platforms. However Perl is often distributed as C source code and must be compiled before it can be installed on your system. This is not a particularly difficult process; in fact it is usually automated.
If you can not find a precompiled binary for your system or you want the experience of compiling the source code yourself, you will need a C compiler on your system. If you do not have one, you may be able to find a version of gcc (an excellent C compiler) that works on your system by checking this ftp site.


Unix Installation Instructions for Perl

Installing Perl on your system is a relatively straightforward process if nothing goes wrong. If something does go wrong, you will need to be very familiar with Unix and your particular system setup to figure out what the problem is. If you are not confident in your ability to debug your system, I suggest that you get an experienced system administrator to accompany you as you install Perl.
  1. Step 1: Become Superuser on your system On most Unix systems you must type the following command and then provide the appropriate password:
    $ su -
    

    If you do not have superuser access to your system, your system administrator will have to install Perl for you.
  2. Step 2: Unpack the Perl distribution
    First, use the cd command to get to the directory where you keep source code on your system:
    $ cd /usr/src
    

    Then, use the tar command to decompress the source code:
    $ gunzip < latest.tar.gz | tar -x
    

    There will now be a directory called /usr/src/perl5.003. To continue, use the cd command to get into that directory:
    $ cd perl5.003
    
  3. Step 3: Configure Perl
    Perl comes with a special shell script that is used to configure Perl for your system. Before you run the Configure script, I highly recommended that you read the 1) readme.txt and 2) install.txt files. They will give you much more detailed instructions than I can provide here. Next, type the following to run the Configure script:
    		  
    $ sh Configure
    

    You will see a lot of messages as Configure examines your system and configures the "make" script. You will be asked questions about how your system works, and some of the questions may require research to answer. When in doubt, it is often sufficient to accept the default answer. But by doing so, you run the risk of having Perl fail and having to run Configure again.
    -d switch (sh Configure -d) 
    

    On most systems, using the -d switch (sh Configure -d) will use all of the defaults without asking you. Actually, there is one place where you will still need to press Return: at the
    1) Press return or 2) use a shell escape to edit config.sh: prompt. Although the -d switch is convenient, it also removes a level of control and you run the risk of your perl install failing.
  4. Step 4: Compile Perl
    Now you can compile Perl. To do so, simply type this command:
    $ make
    
    You will get a lot of messages from the compiler, most of which you can ignore. If the script ends with an error, it will tell you.
  5. Step 5: Validate your installation:
    Now you can run a regression test on your Perl installation:
    $ make test
    

    You will see a lot of tests being executed. Unless there was a problem with your installation, you should eventually see the message:
    All tests successful.
    
  6. Step 6:
    Now you can install the Perl program in its proper directory by running this command:
    $ make install
    

    This will put Perl in /usr/local/bin and a symbolic link in /usr/bin.
    When this is all completed, you are ready to write and run your first Perl script.


Perl installation on Mac OS X

Once you have downloaded and saved to your desktop the MacPerl port for the Macintosh, installation is simple.
  1. Step 1 - Unzip the download
    Unzip the downloaded file with StuffIt Expander or a similar decompression utility.
  2. Step 2 - Run the installer
    Double-click the installer. This will prompt you to select the installation package appropriate for your Macintosh system. Then, select a destination folder for the application and associated files, and click Install.
  3. Step 3 - Read the documentation
    MacPerl should now be installed on your system. Take some time to read over the readme file and while you are at now is the time to closely examine all of the benefits associated with visiting the MACMALL.

The next two lessons will start your journey into learning what Perl actually is and why it's such a popular language with Unix system administrators.
  1. Win32

SEMrush Software