If you haven't heard, local::lib is an awesome module that makes it a snap for unprivileged users to set up a local Perl module library. One way it does that it by making it easy to set PERL5LIB and the default installation path for ExtUtils::MakeMaker and Module::Build in your .bashrc or equivalent.
For ExtUtils::MakeMaker, it just sets an environment variable, PERL_MM_OPT. For Module::Build, it currently creates a options file, .modulebuildrc, inside the local perl library and uses an environment variable to make that the default options file.
That's a bit annoying, because it puts the options file in an unexpected place and does so a bit too magically. A user of local::lib might never realize it's there, create their own ~/.modulebuildrc and wonder why it's not working.
So, thanks to a special request from mst, the next release of Module::Build will include support for a new environement variable, PERL_MB_OPT, to make local::lib's job that much easier and with fewer surprises for end users.
4 Comments
A further downside of the .modulebuildrc that local::lib makes is that the install_base path is hardcoded in there, so if you move that local::lib directory, its .modulebuildrc is no longer correct.
I was looking at local::lib a few weeks ago and couldn't quite figure out the advantage to using it over something like this in .bash_profile:
if [ -d $HOME/lib/perl5 ]; then
PERL5LIB=${PERL5LIB:+$PERL5LIB:}$HOME/lib/perl5
fi
export PERL5LIB
I'd really like to have a better understanding of when and why to use local::lib and wonder if there are some good examples that folks have to share?
Phillip
local::lib sets ExtUtils::MakeMaker and Module::Build to install both Perl modules and programs to a specific directory. That means that you don't have to know the intricacies of configuring CPAN.pm or CPANPLUS to do so.
Further, the incantation for a .bashrc file sets all the environment variables necessary. In your example, you're not getting an architecture specific directory in PERL5LIB.
Here's an example of what local::lib will do using my "cleanroom" user:
Hope that helps clarify.
-- David
Hey there David,
Indeed, that helps a lot. I'll give it another spin this weekend.
Phillip.