Username Password
Bookmark and Share



This article describes how to configure the WRE to use local::lib.


local::lib is a Perl module that allows you to create and use a local lib/ for Perl modules with PERL5LIB. local::lib is designed to make it easy to manage a system with multiple versions of Perl and multiple local lib folders.

Managing multiple versions of Perl

A typical WebGUI developer system contains at least two versions of Perl (one version bundled with the operating system and another bundled with the WRE).

Each version of Perl contains multiple lib/ folders (which Perl learns about through its @INC array). Typically you will have a lib folder for core Perl modules, one or more lib folders containing modules bundled by the distro, and possibly additional folders containing Perl modules you have installed yourself.

By using local::lib, you can keep all modules you install separate from modules bundled with the WRE, in your own local lib folder.

It is assumed that you have already followed the steps in "The WRE and your shell environment" and have created a wre alias for interacting with the WRE.


First you need to install local::lib:

wget # or newer version
tar zxf local-lib-*
cd local-lib-*
wre perl Makefile.PL --bootstrap=/data/wre/prereqs/perl5
make test && make install
cd ..
rm -rf local-lib-*
echo 'eval $(perl -I/data/wre/prereqs/perl5/lib/perl5 -Mlocal::lib=/data/wre/prereqs/perl5)' >> /data/wre/sbin/

You now have a new local lib folder located at: /data/wre/prereqs/perl5

If you type:

wre perl -V

you will see your local lib folder mentioned in Perl's @INC array. The WRE's version of Perl knows about your local lib folder because we added a line to the end of (which is used by the wre command). The line we added tells local::lib to modify the shell environment so that Perl includes your local lib in its @INC array.

It also causes apps such as cpan and cpanminus to install new modules into your local lib, which is how you keep your manually installed modules separate from those bundled with the WRE.


Running the cpan shall is as easy as:

wre cpan
wre cpan Some::Module


First install via cpan:

wre cpan App::cpanminus

And now run via:

wre cpanm

For both cpan and cpanm, your modules will be installed into your local lib.

WRE Scripts

All WRE scripts make use of, so as long as you use the wre command your WRE scripts will automatically make use of your local::lib too.


0patspam: "See also: the following WRE bug:

I suggest that in the meantime you update the $PERL5LIB line in /data/wre/sbin/ so that it reads:
export PERL5LIB=/data/WebGUI/lib #:$PERL5LIB"
Search | Most Popular | Recent Changes | Wiki Home
© 2022 Plain Black Corporation | All Rights Reserved