Installing Perl Modules From CPAN

If you're using ActivePerl in order to run Perl scripts on your Windows server, you can use its included "ppm" command to install or upgrade Perl modules.  But you may find that the versions available via ppm aren't quite up to date, and CPAN has newer versions.

But you can still install those newer versions into your ActivePerl installation.  Just download and unzip the "ModuleName.tar.gz" file from CPAN.  At this point, you may be able to get away with simply copying any *.pm files from here into your C:\Perl\lib\ directory (keeping subdirectories intact).  But if that doesn't work, the proper/official way to proceed is to open a command prompt and switch to the directory where you unzipped the module, and run "perl Makefile.pl" there.  Then run "nmake" followed by "nmake test" and finally "nmake install".  (You can get nmake from Microsoft if you don't already have it; just download the file and unzip it into your C:\Windows\ directory.)

For example, to upgrade your CGI module:

  1. Open a command prompt (click Start, then Run, then type either cmd or command, press Enter) and type this to see what version of CGI.pm you currently have:
    perl -e "use CGI; print $CGI::VERSION";
    (The same command works on Linux/Unix/BSD systems, except use single-quotes instead of double-quotes.)
  2. Create a directory called C:\temp\ if you don't already have one.
  3. Download CGI.pm-3.25.tar.gz into your C:\temp\ directory, then unzip it; this should create the directory C:\temp\CGI.pm-3.25\.
  4. Open a command prompt (or use the same one from before) and type:
    C:
    cd \temp\CGI.pm-3.25\
    perl Makefile.pl
    nmake
    nmake test
    nmake install
    (This is the exact same procedure used on Linux/Unix/BSD systems, except that they use "make" instead of "nmake".)
  5. Repeat step #1 to check your CGI version and it should now be the new version.