Probably

Using Perl local::lib on Solaris 10

by Mark on Feb.10, 2009, under perl

I tend to build perl modules to live in my home directory. Setting up CPAN with PREFIX= and LIB= variables means I can compile/build modules without being root and use them in any script with a simple ‘use lib …’ statement.

Matt Trout of Shadowcat Systems has written local::lib to make this process a whole lot easier.

There’s a good example of setting up local::lib at the Catalyst homepage.

However, try to install local::lib with the ‘perl Makefile.pl –bootstrap’ on a Solaris 10 machine with the system Perl and system tar and you’ll come unstuck.

This is because the newer CPAN module, which local::lib requires, has a filename with a path greater than that supported by the POSIX compliant Sun tar. The installation will break, trying to install CPAN into a system path and thus asking for sudo access.

I’ve discussed this at length with Matt Trout, and thanks to his time and debugging efforts we know it’s CPAN – and hopefully Matt’s feedback to CPAN author Andreas Koenig will result in a fix RSN.

In the meantime, here’s a simple process that will ensure local::lib installs cleanly.

1) Install CSW or Blastwave gtar.

2) Make sure ~/perl5/bin:/usr/perl5/bin:/opt/csw/bin appears on your PATH – in that order.

3) Run ‘cpan’ and configure, making sure makepl_arg gets set to ~/perl5, prerequisites_policy is set to follow and tar is set to /opt/csw/bin/gtar

4) export PERL5LIB=~/perl5/lib:~/perl5/lib/site_perl

5) cpan Test::More Test::Harness File::Temp ExtUtils::MakeMaker ExtUtils::CBuilder ExtUtils::ParseXS Module::Build CPAN

6) Download the latest release of local::lib, untar, and install with ‘perl Makefile.PL –bootstrap && make && make install’

7) unset PERL5LIB, clear cpan makepl_arg

8) eval local::lib as per the instructions, and insert into your chosen shell’s init script (~/.bashrc, for example)

And you’re good to go with local::lib!

:,

2 comments for this entry:

Trackbacks / Pingbacks

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it.

Visit our friends

A few highly recommended friends...