Modules or Packages are bundles of code that are available for free use from either CPAN or ActiveState, which contain many helpful and useful functions.
If you have installed ActivePerl, you will also have installed ActiveState's very own Perl Package Manager (or PPM for short). This provides a handy way of getting at the modules/packages from ActiveState's code repository.
From the command prompt window (click the windows Start button and then 'Run...') type 'ppm'. This will then launch the ppm in a dos prompt window. From there you have several commands available to you, type help to see a list.
To install a package type 'install myPackage', where myPackage is the name of the package you require, eg to install the package HTML-Parser you would type 'install HTML-Parser'.
So what happens if the package you require isn't there? Well as always with Perl, there is more than one way to do it.
If the package you want isn't available as an ActiveState package, you can download the .tar.gz version that is stored on CPAN (http://search.cpan.org). Unzip and untar the contents to a temporary directory.
Open another command prompt window by typing 'command', and change directory to the temporary directory where you saved your package. Type the following commands ensuring there are no errors:
perl Makefile.pl nmake nmake test nmake install
If you do encounter any errors, first check any Readme or similar file that came with the package, for any known problems. If you are still having problems you may be able to contact the author of the package. Failing that there maybe someone on tek-tips who can help you.
Using CPAN or CPANPLUS
To make life even easier there are two packages available on CPAN, that can download and install packages automatically. CPAN.pm is the original package, with CPANPLUS.pm being a rewrite with more features. Take a look are their entries in CPAN for more details, here I will just describe the basics to get you started.
We'll assume you have installed CPAN.pm for this example. To activate it, first open a DOS command line window, then enter the following command:
$> perl -MCPAN -e shell;
The -M tells the Perl intepreter to use the module CPAN. The -e executes the command as if it was part of a script. The shell is a wrapper that handles all the IO to and from the keyboard/screen.
If this is the first time you have used the module you will be asked to configure the CPAN installer. You can accept all the defaults and the installer will search for all the appropriate programs in their usual places. If you get stuck check the module's perldoc.
Once everything is configured you see the following prompt:
From here you can do much the same kind of commands as in PPM. The difference being that this uses CPAN itself rather than a propriety version such as Active State's repository.
To install a module simply type:
cpan> install Package::Module
The added benefit of CPAN.pm and CPANPLUS.pm is that they both understand prerequisites. This means that if you wish to install a module that uses another module that you don't already have installed, it will ask you whether you want to install that as well.
They both automatically test modules before installing them too, so if and module does fail, no damage is done to your system.