Painless Windows Module Installation with PPM
by Josh StroscheinJanuary 11, 2007
I chose Perl for its versatility in the automation of system maintenance. This versatility is largely due to the continued development and support of the numerous modules available on the Comprehensive Perl Archive Network (CPAN). These modules help make Perl a very capable solution to many of the programming obstacles I faced. The choice of Perl had a nice complement in the nearly seamless installation of many of these modules by using a small program provided with ActivePerl called the Perl Package Manager (PPM). PPM is a command-line driven tool that allows programmers to search for and install Perl modules from a wide variety of locations. PPM is only available with the Windows distributions of ActivePerl; hence this article will focus on a Windows environment.
The ActivePerl distribution comes bundled with many popular Perl modules such as LWP, which is a module that provides an API to the World Wide Web, and DBI, which is an API for database interaction. A visit to search.cpan.org will give you an idea of the tremendous amount of modules available. Try executing a search on CPAN and you will typically receive a modest sized list of modules for whatever you are searching. Installing modules with PPM and Internet access is typically straight-forward; therefore I will not cover those details in-depth. However, this is the point during development where I began to run into problems.
About Repositories
My installation package relies heavily on modules not included with the standard ActivePerl distribution. Because I had to assume that the user would not have access to the Internet, my installation package needed to be self-sufficient. PPM's default configuration accesses repositories maintained by ActiveState. Therefore, I needed to develop a way to install Perl modules during an automated installation without access to the Internet.
A repository is essentially a collection of files that provides the necessary information for the PPM program to find, download, and install Perl modules. The use of the word repository tends to get a little confusing. Each PC that PPM runs on has to have a repository configured on it in order to search for modules. It's possible to create a local repository that accessible only on the local machine. It can provide the modules locally or reference another repository located on a server. A web server can host a repository that allows wider access to its modules. This type of repository does not even need the PPM program available to function as long as its' sole purpose is to simply serve modules. Other repositories can link to it to search for modules.
I eventually came up with a couple of viable solutions. The first solution I looked at involved downloading the source code of the modules. These modules typically come in a .tar.gz format. After unzipping and untaring them, I needed to use Nmake to build and install each one. The further I attempted to develop this solution, the more problems I encountered. Having approximately seven modules that I needed to install, this solution required building all of them individually. Because my installation package was completely automated, I needed to accomplish this from a Windows batch file. As I quickly found out, the less I needed to do in a batch file the better! This also raised another issue: the availability of programs outside of my installation package. In this case I would have needed Nmake, which is the Windows equivalent of the Unix Make program, to build and install modules. If the system that the installation package is running on did not have Nmake installed and available in the system path, then I became responsible for locating it on each individual system. The challenges began to compound; I knew there had to be an easier way.
I recalled reading in the ActiveState documentation that the PPM program supports the creation and use of local repositories. After doing some further research, I concluded that I could setup a local repository and bundle the modules in their .tar.gz format with the installation package. I could then use the PPM program, through the use of a batch file, to automate the installation of those modules. This solution would eliminate the need for Internet access, keeping my installation package completely autonomous. It would also provide a dependable solution for building and installing the modules during the installation that did not require any user interaction or outside programs.
|
Related Reading Intermediate Perl |


