Along with Perl, you will need the DBI and DBD modules to write scripts that interact with MySQL. On Windows, with ActivePerl, you can use the Perl Package Manager (PPM) to add the extra DBI and DBD modules. The PPM comes with ActivePerl and simplifies the task of installing CPAN modules. (CPAN, short for Comprehensive Perl Archive Network, is a library of shared code that simplifies common programming tasks.) Despite all of these different tools, the only requirement of the following installation instructions is that you are connected to the Internet as you proceed through them.
1. | Download the most current version of ActivePerl from www.activestate.com.
If you are installing ActivePerl on Windows 2000 or XP, you need to download only the Windows Installer Package (an MSI file). Otherwise, you'll see the other requirements for installation when you go through the download steps. At the time of this writing the current version of ActivePerl was 5.8.7.815.
|
| |
2. | Run the downloaded executable by double-clicking the file ( Figure 8.1).

The installer will take you through a few steps, giving you prompts at certain points to help customize the installation. Accepting the default settings will best ensure problem-free operation of ActivePerl.
Do make sure that you install the PPM (Perl Package Manager) on the Setup page ( Figure 8.2).

This concludes the installation of ActivePerl on your system. Now you'll need to install the database modules.
|
3. | Access a DOS prompt.
There are many ways of doing this, including clicking the Start menu, selecting Run, and entering cmd in the box that appears (then pressing Enter).
|
4. | Test that Perl was successfully installed by entering the following and pressing Enter ( Figure 8.3):
The command perl -v will report on the version of Perl currently installed and running on your system, along with any other pertinent information. This is a simple test of the installation.
|
| |
5. | At the prompt, type ppm and press Enter ( Figure 8.4).
This command should start up the ActivePerl Perl Package Manager. You'll see a ppm> prompt once you are within the application.
|
6. | Install the DBI module by typing this at the prompt and pressing Enter:
PPM will download and install all of the necessary files, reporting on its success ( Figure 8.5).
|
7. | Install the MySQL module for Perl ( Figure 8.6).
Once the DBI package has been installed, you'll need to install the database-specific modules, such as DBD-MySQL. The Perl scripts will use DBI and DBD-MySQL together to connect to the databases.
|
8. | Exit out of PPM by typing quit and pressing Enter.
|