BigAdmin System Administration Portal
Community-Submitted Tech Tip
Print-friendly VersionPrint-friendly Version
This content is submitted by a BigAdmin user. It has not been reviewed for technical accuracy by Sun Microsystems, though it may have been lightly edited to improve readability. If you find an error or would like to comment on the article, please contact the submitter or use the comment field at the bottom of the article. Community submissions may not follow Sun trademark guidelines. For information on Sun trademarks, please see http://www.sun.com/suntrademarks/.
 
 

Installing Non-Core Perl Modules

Stuart Abrams-Humphries, March 2007

This document shows how to install non-core Perl modules in environments running the Solaris Operating System and Linux. This procedure can give application and development teams more control over what Perl modules they use, upgrade, and remove. (Note: This should work with all versions of the Solaris OS and Linux.)


Introduction

To enable a simple installation of Perl on all machines, application and development teams can install non-core Perl modules in directories they control. Installing non-core Perl modules lets teams use, upgrade, and remove non-core modules without affecting any extra Perl modules that have been added to a machine. It also means that the modules can be used with an upgraded version of Perl, if necessary. Additionally, in a clustered environment, the non-core Perl modules can be installed on a shared disk so they will be consistent across all nodes in a cluster when a service group fails over between machines.


Prerequisites

The non-core Perl module needs to be built with the same version of the C compiler as Perl itself was built with. To see which compiler Perl was built with, type the following command:

perl -V

Then ensure that the same compiler version is installed on the machine, whether it's the GNU Compiler Collection (GCC) or the Sun Studio C compiler (or an older version).


Installation

Follow these steps to install a non-core Perl module on a machine:

1. Download the Perl module source (for example, from CPAN, the Comprehensive Perl Archive Network web site).

2. Normally, you will have a <modulename>.tar.gz file.

3. Extract the module file:

tar -xvzf <modulename>.tar.gz

Alternatively, you can decompress the file using gzip -d and then extract the file using tar -xvf.

4. Create a makefile for the module by typing the following commands:

perl Makefile.PL PREFIX=<moduleinstalldir> LIB=<moduleinstalldir>/lib
INSTALLMAN1DIR=<moduleinstalldir>/man/man1
INSTALLMAN3DIR=<moduleinstalldir>/man/man3

5. Run the make command:

make

6. Install the module:

make install

Using the New Module

To use the newly installed Perl module, insert the following lines at the top of your Perl scripts:

#!/usr/bin/perl

use lib '<moduleinstalldir>/lib';
use mod::bang;

Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.


BigAdmin
  
 
 
 
Would you recommend this Sun site to a friend or colleague?
Contact About Sun News & Events Employment Site Map Privacy Terms of Use Trademarks Copyright Sun Microsystems, Inc.