Installing the VI Perl Toolkit from Source Code

The VI Perl Toolkit can be installed from souce code on any platform that supports Perl.


Obtaining the pre-requisites and installing them is part of the platform-specific installation instructions that follow.

Installing the VI Perl Toolkit on Linux

Many Linux distributions include Perl and some or all of the required modules, by default. If not, you will need to install all pre-requisites before installing the VI Perl Toolkit.

Obtaining and Installing Pre-requisites

The instructions below guide you through the process of obtaining the modules from CPAN and building them on the host system. However, you can also use the Perl Package Manager (PPM) to streamline the process.

  1. Launch your browser and navigate to the CPAN search page:

  2. Select Modules from the drop-down list.
  3. Enter the name of the module in the search text box. Spell and punctuate precisely, including colons when appropriate, as shown here:

    Module, library:
    Crypt-SSLeay (0.51)
    Data-Dumper (2.102)
    MethodMaker (2.0.8)
    XML-LibXML (1.58)
    libwww-perl (5.805)
    Search for:
    CPAN Search page
  4. Click the CPAN Search button to initiate the search. Shortly, a results page displays listing one or more links to the module or library. Various versions and sub-packages may be included.
  5. Click the most appropriate link to display the download page for the module. The download page includes information about the module or library, links to source code, and a link to the downloadable archive file in the upper-right-hand corner of the page.
  6. Click the Download link to initiate the download. The browser’s File Download dialog displays, enabling you to save the file to disk. Click the Save button and navigate to the sub-directory in which you want to save the download.
  7. Navigate to the /tmp directory and save the download.

    After downloading any missing Perl libraries from the CPAN website, you can unpack and install them.
  8. Open a Linux shell session and navigate to the directory containing the downloaded packages.
    cd /tmp
  9. Unzip the package, if necessary. For example:
    gunzip Class-MethodMaker-2.08.tar.gz
  10. Extract the files from the package. For example:
    tar xf Class-MethodMaker-2.08.tar
  11. Navigate to the sub-directory containing the extracted files. For example:
    cd Class-MethodMaker-2.08
  12. Review the README file. It contains (among other things) the name and description of the library, the minimum version of Perl required, and a list of required packages (if any).
    less README
  13. Read the INSTALL file for information about how to install the module.
    less INSTALL
  14. Follow the instructions in the module’s INSTALL file. Note that you must typically perform the final step (make install) as the root user. Depending on your privileges (whether you can use sudo or not), follow one of these two approaches:
    Authorized to use sudoNot authorized to use sudo
    make test
    sudo make install
    make test
    su root
    make install

Using CPAN Module to Install Linux

An alternative way to install any missing modules is to use the CPAN module that’s part of the Perl distribution. To launch the CPAN shell:

perl -MCPAN -e shell

You will be prompted to provide some basic information, including the source from which to obtain the modules, where to build them, and so on. You can obtain the necessary Perl libraries from CPAN (Comprehensive Perl Archive Network) or another reliable source, and for most of the other prompts, simply accept the defaults. Shortly, the cpan> prompt displays:


To find the module:

cpan> i /pat/

where pat is a pattern, such as part of the name of the missing module.

Obtaining the VI Perl Toolkit Sourcecode

The VI Perl Toolkit source-code package comprises a single platform-independent compressed file, available from Sourceforge.

  1. Launch a browser and navigate to the VI Perl Toolkit download:
  2. Click the Download VMware Infrastructure (VI) Perl Toolkit button. The About VMware Infrastructure Toolkit page displays, listing packages available for download with information about release dates, file size, and dates. Find the VI Perl Toolkit Beta package from among those listed:
  3. Click the Download button to display a list of files available for download. Since the VI Perl Toolkit comprises a single platform-independent install, only one file is available:
  4. Click the file name to begin the download process. A dialog box displays, enabling you to save the file to disk.
  5. Navigate to the /tmp (or /temp, for Windows) sub-directory to save the file.
  6. Click Save to save the file.
  7. Open a Linux shell session.
  8. Change to the directory in which you downloaded the package.
    cd /tmp
  9. Unzip the package, if necessary (some systems may de-compress during download).
    gunzip filename.tar.gz
  10. Extract the files from the package.
    tar xf filename.tar
  11. Change to the directory containing the extracted files.
    cd viperltoolkit
  12. Review the README file for information about licensing, additional requirements, and late-breaking information.
    less README

Running the Installation Script

Assuming that the Linux host meets all requirements, you can run the Makefile.PL for the Toolkit.

cd /tmp/viperltoolkit
perl Makefile.PL

If any of the Perl pre-requisites are missing, you’ll see warning messages, such as Warning: prerequisite Data::Dumper 2.121 not found. We have 2.12. Return to Obtaining and Installing Pre-requisites and finish installing all pre-requisites before proceeding.

  1. Build the Toolkit files.
  2. Verify that the build succeeded by running the test.
    make test
  3. Install the Toolkit files.
    make install

Installing the VI Perl Toolkit on Windows

To install the VI Perl Toolkit on Windows, you must obtain a Windows implementation of Perl and various libraries; install the VI Perl Toolkit ; and perform a few other basic setup tasks. From start to finish, the entire process takes about 15 minutes (or less, if you already have Perl installed).

These instructions (adapted from Richard Garsthagen’s excellent HOW-TO, available on his Run-Virtual website) have been tested on a Windows XP system.

  1. Obtain and install ActivePerl 5.8, available from:

    You will need to register at ActivePerl’s website to download the software.
  2. Launch the Perl Package Manager (PPM) by running the batch file (ppm.bat) at the command prompt:
  3. From the PPM Edit menu, select Preferences... and add the path to the University of Winnipeg’s PPM (Perl library) as a repository from which to obtain modules and packages:

  4. Select these modules and packages:
    Perl Package Manager (PPM) Screenshot—Click to display larger image

    As the required packages are installed, you may be prompted to install various other supporting packages. Accept any additional installations. The process may take a few minutes to complete, but it’s fairly simple.
  5. Obtain Microsoft’s nmake from:
    The page that displays at the URL above is a support page that includes a link to nmake15.exe, which is a self-extracting compressed file that unpacks nmake.exe, nmake.err, and a readme.txt file.
  6. Scroll through the page that opens to find the link for nmake15.exe on the page.
  7. Click the nmake15.exe link. A save dialog displays.
  8. Select Save to Disk and click OK. A navigation dialog box displays.
  9. Launch a Windows console session (cmd.exe).
  10. Navigate to the location of the VI Perl Toolkit download and run these commands:


    The console displays progress:
    Writing Makefile for VIPerlToolkit
  11. Enter nmake at the command prompt:

  12. Enter nmake install at the command prompt:
    C:\viperltoolkit>nmake install

The console reports status as the VI Perl Toolkit components (VIRuntime.html, VIStub.html,, and so on) are installed, and in a few seconds, the process completes.

Validating the VI Perl Toolkit Installation

After installing the VI Perl Toolkit Virtual Appliance (or installing manually on Linux or Windows), you can confirm successful installation by running any one of the Utility Applications, or by running one of the sample scripts.

Running a Sample Script

To navigate to the samples sub-directory

In the samples sub-directory, you’ll find several other sub-directories, including:

The (in the \samples\discovery folder), is a good place to start. It’s a basic discovery utility that obtains a list of hosts and virtual machines running at the specified server. You must pass to the script (as a parameter) the name of the ESX Server host or VirtualCenter Management Server host system.

To run the script:

  1. Navigate to the /samples sub-directory:

  2. Enter perl and the precise name of the script (capitalization must match), including the path within the /samples directory, passing any required parameters. For example, for the datacenterlisting script, you would enter:

    perl discovery/ --host 'servername_or_ip_address' --datacenter 'datacenter_name'

    Or simply navigate to the /discovery before running the script, saving yourself from typing the directory name:

    cd discovery
    perl --server 'servername' --datacenter 'datacenter_name'

For example, running against a VirtualCenter Management Server might be as follows:

perl discovery/ --server --datacenter Primary_Datacenter --username Administrator --password password

If you are testing your setup against an ESX Server host, you must pass an empty string to the datacenter parameter, as in:

perl discovery/ --server --datacenter ' ' --username root --password password

Copyright © 2007 VMware, Inc. All rights reserved.

VI Perl Toolkit 1.0 | Released 30-Aug-2007 | Last updated 28-August-2007 7:00 pm