KBEC-00180 - Installing Perl modules into the Flow Perl distribution

Description

This article discusses how to expand the Flow Perl distribution by adding Perl modules, say from CPAN or third-party vendors.

Solution

Install Perl modules using the CPAN installer. The installer comes with the Flow Perl distribution in <commanderDir>/perl/bin.

On Linux

From the command line use:

<commanderDir>/perl/bin/perl -MCPAN -e 'install <module>'

On Windows

  1. To be compatible with Flow:
    1. Flow 6.x distributions use Perl 5.8 for ec-perl
    2. If the Perl package is not Perl only and requires compiling for say C code:
      1. Use Windows Visual Studio VC6. This is what Flow uses and you want to use the same version.
      2. Make sure that cl and nmake are both on your path. The Windows Visual Studio install comes with a Command Prompt that has these executables already in the path.
  2. There are additional steps on Windows because there is a problem with Perl and CPAN when running from a directory with spaces in the name. By default, Flow has spaces in the install directory.
          1. Use a network drive to eliminate other references to spaces in the path.
              1. Use subst to mount the Perl directory under a different drive letter:
            c:\> subst x: "c:\program files\electric cloud\electriccommander"
            1. Temporarily add X:\perl\bin to your Windows path.
          2. Change the <commanderDir>\perl\lib\config.pm file to eliminate spaces in references to the Flow path. For example:
    #archlibexp => 'C:\Program Files\Electric Cloud\ElectricCommander\perl\lib',
    archlibexp => 'X:\perl\lib',
    #privlibexp => 'C:\Program Files\Electric Cloud\ElectricCommander\perl\lib',
    privlibexp => 'X:\perl\lib',
    #scriptdir => 'C:\Program Files\Electric Cloud\ElectricCommander\perl\lib',
    scriptdir => 'X:\perl\lib',
    #sitearchexp => 'C:\Program Files\Electric Cloud\ElectricCommander\perl\site\lib',
    sitearchexp => 'X:\perl\site\lib',
    #sitelibexp => 'C:\Program Files\Electric Cloud\ElectricCommander\perl\site\lib',
    sitelibexp => 'X:\perl\site\lib',
    
        1. Use the CPAN installer to complete the module install.
            • Start CPAN from the new location:
          c:\> x:\perl\bin\perl -MCPAN -e shell
            • Configure CPAN to install in the new location:
          cpan> o conf makepl_arg PREFIX=x:/perl
            • Install the module
          cpan> install <module>

            • Ending CPAN
          cpan> quit

    Flow upgrade

    During a Flow upgrade, the installer makes every attempt to preserve Perl packages. In the future, however, the version of Perl may change, which may entail the reinstall of the added Perl packages.

    Other sources of help

    Here are some descriptions on how to install CPAN modules:

        1. http://perl.about.com/od/packagesmodules/qt/perlcpan.htm
        2. http://search.cpan.org/src/CMUNGALL/go-perl-0.08/INSTALL.html (a specific module install example)

    Alternative Plugin Approach for Flow-specific Perl Modules

    Another approach is to leverage the plugin technology by adding a subdirectory to the plugin hierarchy to house the Perl module.

    Assume you have a plugin named cmdrUtils that has a src/lib directory containing two perl modules (ecUtils.pm and dbgUtils.pm).

    Reference these modules from Flow steps or command line scripts as follows:

    From steps:

    use lib "$ENV{'COMMANDER_PLUGINS'}/$[/plugins/dfUtils]/lib";
      use dbgUtils;
      use ecUtils;
    

    From command line scripts (after setting the appropriate ECPERLLIB env var in the startup scripts):

    use lib "$ENV{'ECPERLLIB'}";
      use dbgUtils;
      use ecUtils;
    

    This way, the Perl modules' versions are manageable and access to the Flow server installation hierarchy is not necessary, only a login that can install plugins.

Have more questions? Submit a request

Comments

Powered by Zendesk