user181548
user181548

Reputation:

How do I use a dependency on a Perl module installed in a non-standard location?

I need to install two Perl modules on a web host. Let's call them A::B and X::Y. X::Y depends on A::B (needs A::B to run). Both of them use Module::Install. I have successfully installed A::B into a non-system location using

perl Makefile.PL PREFIX=/non/system/location
make; make test; make install

Now I want to install X::Y, so I try the same thing

perl Makefile.PL PREFIX=/non/system/location

The output is

$ perl Makefile.PL PREFIX=/non/system/location/
Cannot determine perl version info from lib/X/Y.pm
*** Module::AutoInstall version 1.03
*** Checking for Perl dependencies...
[Core Features]
- Test::More          ...loaded. (0.94)
- ExtUtils::MakeMaker ...loaded. (6.54 >= 6.11)
- File::ShareDir      ...loaded. (1.00)
- A::B                ...missing.
==> Auto-install the 1 mandatory module(s) from CPAN? [y] 

It can't seem to find A::B in the system, although it is installed, and when it tries to auto-install the module from CPAN, it tries to write it into the system directory (ignoring PREFIX). I have tried using variables like PERL_LIB and LIB on the command line, after PREFIX=..., but nothing I have done seems to work.

I can do make and make install successfully, but I can't do make test because of this problem. Any suggestions?

I found some advice at http://servers.digitaldaze.com/extensions/perl/modules.html to use an environment variable PERL5LIB, but this also doesn't seem to work:

export PERL5LIB=/non/system/location/lib/perl5/

didn't solve the problem.

Upvotes: 3

Views: 937

Answers (3)

barryoff
barryoff

Reputation: 1

Because this is the top link i thought i'd update with my experience (which has taken a while to get working, hence updating the 7 year old post).

first run perl -le 'print join $/, @INC'

add (note, no / at the end!!) export PERL5LIB=/nonstddir/scripts/modules/lib/site_perl:/nonstddir/scripts/modules/lib

run perl -le 'print join $/, @INC' make sure the new dirs are added. this makes it work. if you add a / at the end of the path, the INC entry will look weird and wrong. Mine had a // in the middle.

When done and working, mine looks like

/nonstddir/scripts/modules/lib/site_perl/5.8.4/sun4-solaris-64int
/nonstddir/scripts/modules/lib/site_perl/5.8.4
/nonstddir/scripts/modules/lib/site_perl
/nonstddir/scripts/modules/lib/sun4-solaris-64int
/nonstddir/scripts/modules/lib
/usr/perl5/5.8.4/lib/sun4-solaris-64int
/usr/perl5/5.8.4/lib
/usr/perl5/site_perl/5.8.4/sun4-solaris-64int
/usr/perl5/site_perl/5.8.4
/usr/perl5/site_perl
/usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int
/usr/perl5/vendor_perl/5.8.4
/usr/perl5/vendor_perl

Upvotes: 0

user181548
user181548

Reputation:

OK, the following prescription did it:

perl Makefile.PL --skipdeps --no-manpages PREFIX=/non/system/location INSTALLSITELIB=/non/system/location/lib INSTALLSITEBIN=/non/system/location/bin INSTALLMAN1DIR=/non/system/location/man/man1 INSTALLMAN3DIR=/non/system/location/man/man3

This is just "monkey see monkey do" but now make test works.

  • The --skipdeps option here suppresses a convenient feature/exasperating problem with Module::Install where it tries to use CPAN.pm to download missing modules.
  • The --no-manpages is supposed to stop it installing man pages but it doesn't work.

Upvotes: 0

zoul
zoul

Reputation: 104065

The answer is local::lib, but you probably already know that :)

Upvotes: 0

Related Questions