Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello PerlMonks,

I'm trying to create a Perl "distribution" which includes both Perl proper (as downloaded from perl.org) and a number of CPAN modules. (Sorry if I'm not using the correct lingo; I'm new to the community.)

The actual Perl part went pretty well. A couple parameters passed into Configure and a
make make test make install DESTDIR=/home/me/build/perl/inst
later and I'm off and running.
setenv PATH /home/me/build/perl/inst/usr/local/bin:$PATH setenv PERL5LIB /home/me/build/perl-addons/inst/usr/local/lib/perl5:/h +ome/me/build/perl-addons/inst/usr/local/lib/perl5/site_perl:/home/me/ +build/perl/inst/usr/local/lib/perl5:/home/me/build/perl/inst/usr/loca +l/lib/perl5/site_perl [me@unixbox1:/home/me/build]> perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: ... Characteristics of this binary (from libperl): Compile-time options: PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO Built under solaris Compiled at Jan 18 2007 07:45:13 %ENV: PERL5LIB="/home/me/build/perl-addons/inst/usr/local/lib/perl5:/hom +e/me/build/perl-addons/inst/usr/local/lib/perl5/site_perl:/home/me/bu +ild/perl/inst/usr/local/lib/perl5:/home/me/build/perl/inst/usr/local/ +lib/perl5/site_perl" @INC: /home/me/build/perl-addons/inst/usr/local/lib/perl5 /home/me/build/perl-addons/inst/usr/local/lib/perl5/site_perl /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8 /home/me/build/perl/inst/usr/local/lib/perl5 /home/me/build/perl/inst/usr/local/lib/perl5/site_perl/5.8.8/sun4- +solaris /home/me/build/perl/inst/usr/local/lib/perl5/site_perl/5.8.8 /home/me/build/perl/inst/usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.8/sun4-solaris /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl .
It's the CPAN modules that I'm now having problems with. Really basic modules like HTML::Template seem to go okay although they give me a couple warnings about Config.pm and the architecture that I'd like to eliminate if possible:
[me@unixbox1:/home/me/build/perl-addons/tmp/HTML-Template-2.8]> perl M +akefile.PL PREFIX=/home/me/build/perl-addons/inst/usr/local PERL_LIB= +/home/me/build/perl/inst/usr/local/lib/perl5/5.8.8 PERL_ARCHLIB=/home +/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris Checking if your kit is complete... Looks good Have /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris/C +onfig.pm expected /usr/local/lib/perl5/5.8.8/sun4-solaris/Config.pm Your perl and your Config.pm seem to have different ideas about the architecture they are running on. Perl thinks: [sun4-solaris] Config says: [sun4-solaris] This may or may not cause problems. Please check your installation of +perl if you have problems building this extension. Writing Makefile for HTML::Template
A make; make test; make install cycle works and the new module is found:
[me@unixbox1:/home/me/build/perl-addons/tmp/HTML-Template-2.8]> perl - +MHTML::Template -e 'print "$HTML::Template::VERSION\n"' 2.8
Anything more complex (like MQSeries, say) starts to cause problems:
[me@unixbox1:/home/me/build/perl-addons/tmp/MQSeries-1.23]> perl Makef +ile.PL PREFIX=/home/me/build/perl-addons/inst/usr/local PERL_LIB=/hom +e/me/build/perl/inst/usr/local/lib/perl5/5.8.8 PERL_ARCHLIB=/home/me/ +build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris Creating directory MQServer/ Copying MQClient/MQSeries.pm.in -> MQServer/MQSeries.pm.in Creating directory MQServer/MQSeries.xs.in/ Copying MQClient/MQSeries.xs.in/00header -> MQServer/MQSeries.xs.in/00 +header Copying MQClient/MQSeries.xs.in/21core -> MQServer/MQSeries.xs.in/21co +re Copying MQClient/MQSeries.xs.in/30MQCONN -> MQServer/MQSeries.xs.in/30 +MQCONN Copying MQClient/MQSeries.xs.in/31MQCONNX-v5 -> MQServer/MQSeries.xs.i +n/31MQCONNX-v5 Copying MQClient/MQSeries.xs.in/32MQOPEN-v2 -> MQServer/MQSeries.xs.in +/32MQOPEN-v2 Copying MQClient/MQSeries.xs.in/32MQOPEN-v5 -> MQServer/MQSeries.xs.in +/32MQOPEN-v5 Copying MQClient/MQSeries.xs.in/33MQINQ -> MQServer/MQSeries.xs.in/33M +QINQ Copying MQClient/MQSeries.xs.in/34MQPUT-v2 -> MQServer/MQSeries.xs.in/ +34MQPUT-v2 Copying MQClient/MQSeries.xs.in/34MQPUT-v5 -> MQServer/MQSeries.xs.in/ +34MQPUT-v5 Copying MQClient/MQSeries.xs.in/35MQPUT1-v2 -> MQServer/MQSeries.xs.in +/35MQPUT1-v2 Copying MQClient/MQSeries.xs.in/35MQPUT1-v5 -> MQServer/MQSeries.xs.in +/35MQPUT1-v5 Copying MQClient/MQSeries.xs.in/36MQGET -> MQServer/MQSeries.xs.in/36M +QGET Copying MQClient/MQSeries.xs.in/37MQCLOSE -> MQServer/MQSeries.xs.in/3 +7MQCLOSE Copying MQClient/MQSeries.xs.in/38MQDISC -> MQServer/MQSeries.xs.in/38 +MQDISC Copying MQClient/MQSeries.xs.in/39MQCMIT -> MQServer/MQSeries.xs.in/39 +MQCMIT Copying MQClient/MQSeries.xs.in/40MQBACK -> MQServer/MQSeries.xs.in/40 +MQBACK Copying MQClient/MQSeries.xs.in/41MQBEGIN-v5 -> MQServer/MQSeries.xs.i +n/41MQBEGIN-v5 Copying MQClient/MQSeries.xs.in/42MQSET -> MQServer/MQSeries.xs.in/42M +QSET Copying MQClient/Makefile.PL -> MQServer/Makefile.PL Copying MQClient/constants.c.PL -> MQServer/constants.c.PL Copying MQClient/typemap.PL -> MQServer/typemap.PL Checking if your kit is complete... Looks good Have /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris/C +onfig.pm expected /usr/local/lib/perl5/5.8.8/sun4-solaris/Config.pm Your perl and your Config.pm seem to have different ideas about the architecture they are running on. Perl thinks: [sun4-solaris] Config says: [sun4-solaris] This may or may not cause problems. Please check your installation of +perl if you have problems building this extension. Warning: PERL_LIB (/usr/local/lib/perl5/5.8.8) seems not to be a perl +library directory (Exporter.pm not found) at /home/me/build/perl/inst/usr/local/ +lib/perl5/5.8.8/ExtUtils/MM_Unix.pm line 1668. Have /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris/C +onfig.pm expected /usr/local/lib/perl5/5.8.8/sun4-solaris/Config.pm Your perl and your Config.pm seem to have different ideas about the architecture they are running on. Perl thinks: [sun4-solaris] Config says: [sun4-solaris] This may or may not cause problems. Please check your installation of +perl if you have problems building this extension. Note (probably harmless): No library found for -lmqicg Note (probably harmless): No library found for -lmqic32 Writing Makefile for MQClient::MQSeries Warning: PERL_LIB (/usr/local/lib/perl5/5.8.8) seems not to be a perl +library directory (Exporter.pm not found) at /home/me/build/perl/inst/usr/local/ +lib/perl5/5.8.8/ExtUtils/MM_Unix.pm line 1668. Have /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris/C +onfig.pm expected /usr/local/lib/perl5/5.8.8/sun4-solaris/Config.pm Your perl and your Config.pm seem to have different ideas about the architecture they are running on. Perl thinks: [sun4-solaris] Config says: [sun4-solaris] This may or may not cause problems. Please check your installation of +perl if you have problems building this extension. Writing Makefile for MQSeries::Message::DeadLetter Warning: PERL_LIB (/usr/local/lib/perl5/5.8.8) seems not to be a perl +library directory (Exporter.pm not found) at /home/me/build/perl/inst/usr/local/ +lib/perl5/5.8.8/ExtUtils/MM_Unix.pm line 1668. Have /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris/C +onfig.pm expected /usr/local/lib/perl5/5.8.8/sun4-solaris/Config.pm Your perl and your Config.pm seem to have different ideas about the architecture they are running on. Perl thinks: [sun4-solaris] Config says: [sun4-solaris] This may or may not cause problems. Please check your installation of +perl if you have problems building this extension. Writing Makefile for MQSeries::Message::PCF Warning: PERL_LIB (/usr/local/lib/perl5/5.8.8) seems not to be a perl +library directory (Exporter.pm not found) at /home/me/build/perl/inst/usr/local/ +lib/perl5/5.8.8/ExtUtils/MM_Unix.pm line 1668. Have /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris/C +onfig.pm expected /usr/local/lib/perl5/5.8.8/sun4-solaris/Config.pm Your perl and your Config.pm seem to have different ideas about the architecture they are running on. Perl thinks: [sun4-solaris] Config says: [sun4-solaris] This may or may not cause problems. Please check your installation of +perl if you have problems building this extension. Writing Makefile for MQSeries::Message::RulesFormat Warning: Guessing NAME [MQSeries-OAM] from current directory name. Warning: PERL_LIB (/usr/local/lib/perl5/5.8.8) seems not to be a perl +library directory (Exporter.pm not found) at /home/me/build/perl/inst/usr/local/ +lib/perl5/5.8.8/ExtUtils/MM_Unix.pm line 1668. Have /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris/C +onfig.pm expected /usr/local/lib/perl5/5.8.8/sun4-solaris/Config.pm Your perl and your Config.pm seem to have different ideas about the architecture they are running on. Perl thinks: [sun4-solaris] Config says: [sun4-solaris] This may or may not cause problems. Please check your installation of +perl if you have problems building this extension. Warning: PERL_LIB (/usr/local/lib/perl5/5.8.8) seems not to be a perl +library directory (Exporter.pm not found) at /home/me/build/perl/inst/usr/local/ +lib/perl5/5.8.8/ExtUtils/MM_Unix.pm line 1668. Have /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris/C +onfig.pm expected /usr/local/lib/perl5/5.8.8/sun4-solaris/Config.pm Your perl and your Config.pm seem to have different ideas about the architecture they are running on. Perl thinks: [sun4-solaris] Config says: [sun4-solaris] This may or may not cause problems. Please check your installation of +perl if you have problems building this extension. Writing Makefile for MQSeries::PubSub Warning: PERL_LIB (/usr/local/lib/perl5/5.8.8) seems not to be a perl +library directory (Exporter.pm not found) at /home/me/build/perl/inst/usr/local/ +lib/perl5/5.8.8/ExtUtils/MM_Unix.pm line 1668. Have /home/me/build/perl/inst/usr/local/lib/perl5/5.8.8/sun4-solaris/C +onfig.pm expected /usr/local/lib/perl5/5.8.8/sun4-solaris/Config.pm Your perl and your Config.pm seem to have different ideas about the architecture they are running on. Perl thinks: [sun4-solaris] Config says: [sun4-solaris] This may or may not cause problems. Please check your installation of +perl if you have problems building this extension. Writing Makefile for MQServer::MQSeries Writing Makefile for MQSeries
My understanding here is that ExtUtils::MakeMaker has the intelligence to cascade into subdirectories looking for other Makefile.PLs to run. Based on the output, it looks like its not passing on the parameters that I've passed in (PERL_LIB and PERL_ARCHLIB). I've also attempted upgrading ExtUtils::MakeMaker and the tests are failing in ways that make me believe that my PERL_LIB isn't being honored:
t/PL_FILES..............NOK 3# Failed test in t/PL_FILES.t at line 3 +8. # got: '512' # expected: '0' # make[1]: Entering directory `/home/me/build/perl-addons/tmp/ExtUtils +-MakeMaker-6.31/t/PL_FILES-Module' # make[1]: *** No rule to make target `/usr/local/lib/perl5/5.8.8/sun4 +-solaris/Config.pm', needed by `Makefile'. Stop. # make[1]: Leaving directory `/home/me/build/perl-addons/tmp/ExtUtils- +MakeMaker-6.31/t/PL_FILES-Module' t/PL_FILES..............NOK 4# Failed test 'single.out was created' + # in t/PL_FILES.t at line 41. # Failed test '1.out was created' t/PL_FILES..............NOK 5# in t/PL_FILES.t at line 41. + t/PL_FILES..............NOK 6# Failed test '2.out was created' + # in t/PL_FILES.t at line 41. t/PL_FILES..............NOK 7# Failed test 'blib/lib/PL/Bar.pm was c +reated' # in t/PL_FILES.t at line 41. t/PL_FILES..............ok 8/9# Looks like you failed 5 tests of 9. + t/PL_FILES..............dubious + Test returned status 5 (wstat 1280, 0x500) DIED. FAILED tests 3-7 Failed 5/9 tests, 44.44% okay t/pm....................ok 1/6Warning: PERL_LIB (/usr/local/lib/perl5/ +5.8.8) seems not to be a perl library directory (Exporter.pm not found) at /home/me/build/perl-addons/tmp/ExtU +tils-MakeMaker-6.31/blib/lib/ExtUtils/MM_Unix.pm line 1716. Warning: PERL_LIB (/usr/local/lib/perl5/5.8.8) seems not to be a perl +library directory (Exporter.pm not found) at /home/me/build/perl-addons/tmp/ExtU +tils-MakeMaker-6.31/blib/lib/ExtUtils/MM_Unix.pm line 1716. t/pm....................ok + t/postamble.............ok 3/8 + # Failed test 'postamble argument not warned about' t/postamble.............NOK 4# in t/postamble.t at line 52. + # got: 'Warning: PERL_LIB (/usr/local/lib/perl5/5.8.8) seems +not to be a perl library directory # (Exporter.pm not found) at /home/me/build/perl-addons/tmp/Ex +tUtils-MakeMaker-6.31/blib/lib/ExtUtils/MM_Unix.pm line 1716. # ' # expected: '' # Looks like you failed 1 test of 8. t/postamble.............dubious + Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 4 Failed 1/8 tests, 87.50% okay t/prefixify.............ok + 1/3 skipped: Test for DOSish prefixification t/prereq_print..........ok + t/problems..............ok + t/prompt................ok + t/recurs................ok 3/25 + t/recurs................NOK 6# Failed test 'recursive make exited no +rmally' # in t/recurs.t at line 61. # got: '512' # expected: '0' # make[1]: Entering directory `/home/me/build/perl-addons/tmp/ExtUtils +-MakeMaker-6.31/t/Recurs' # make[1]: *** No rule to make target `/usr/local/lib/perl5/5.8.8/sun4 +-solaris/Config.pm', needed by `Makefile'. Stop. # make[1]: Leaving directory `/home/me/build/perl-addons/tmp/ExtUtils- +MakeMaker-6.31/t/Recurs' t/recurs................ok 11/25 + # Failed test 'recursive make exited normally' t/recurs................NOK 14# in t/recurs.t at line 84. + # got: '512' # expected: '0' t/recurs................ok 19/25# Looks like you failed 2 tests of 25.
So, I'm running into a LOT of problems using a local Perl install to locally install CPAN modules. Is my approach flawed or can this simply not be done?

I'm trying to installing Perl in one place and a bunch of CPAN modules in another place for packaging purposes (net result being two separate packages). I don't have write access to the system directories (/usr/local). The Perl part seems to be covered, but I can't complete installation of the modules that I need to distribute.

Any direction the Monks could provide would be great.

Thanks.

20070130 Janitored by Corion: Added readmore tag, as per Writeup Formatting Tips

Replies are listed 'Best First'.
Re: installing CPAN modules locally with a local perl installation
by Joost (Canon) on Jan 29, 2007 at 16:53 UTC
      Yes; I'm positive.
      [me@unixbox1:/home/me/build/perl-addons/tmp/MQSeries-1.23]> which perl /home/me/build/perl/inst/usr/local/bin/perl
Re: installing CPAN modules locally with a local perl installation
by glasswalk3r (Friar) on Jan 29, 2007 at 17:04 UTC

    Maybe is possible to do what you want, but if you only want a local repository, you can save yourself a lot of trouble using CPAN::Mini.

    I've being using it in a regular PC without Internet connection with good results. Of course you will need to configure the CPAN module to use your local repository.

    I have faced some issues regarding the CPAN shell not being smart enough to grab the files 01mailrc.txt.gz, 02packages.details.txt.gz and 03modlist.data.gz by itself (it keeps trying to fetch them from the Internet) but this can be easily solved if you just gunzip them before running reload index in the CPAN shell.

    Alceu Rodrigues de Freitas Junior
    ---------------------------------
    "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
Re: installing CPAN modules locally with a local perl installation
by EvanK (Chaplain) on Jan 29, 2007 at 16:57 UTC
    off the top of my head, I would just make sure that when you execute the Makefile.PL scripts in the respective modules, that you explicitly specify which perl binary to use:
    # instead of an implicit path (which might end up using /usr/bin/perl) perl Makefile.PL # use an explicit path to the perl binary you want /home/me/build/perl/inst/usr/local/bin/perl Makefile.PL
    Hope that helps. If not, hopefully a more knowledgeable monk can help you.

    __________
    The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.
    - Terry Pratchett

Re: installing CPAN modules locally with a local perl installation
by Anonymous Monk on Jan 29, 2007 at 20:29 UTC
    For reasons that I don't understand, it makes a difference where I attempt to install a CPAN module from.

    I configured and built perl from /home/me/build/perl/perl-5.8.8 and have been attempting to configure and install CPAN modules from /home/me/build/perl-addons/tmp/<Module>. I've been trying to force ExtUtils::MakeMaker to recognize the perl directory by supplying a PERL_LIB and PERL_ARCHLIB.

    If I simply work from /home/me/build/perl/perl-5.8.8/<Module> then ExtUtils::MakeMaker finds everything with no coercion necessary; the warnings about Config.pm and architecture go away.

    This leads me to think that maybe I'm not passing the right parameters to perl Makefile.PL (currently PREFIX, PERL_LIB, and PERL_ARCHLIB). A quick read through ExtUtils::MakeMaker's perldoc seems to indicate that only PERL_LIB and PERL_ARCHLIB should be necessary. Setting PERL_SRC (which happens automatically when working from /home/me/build/perl/perl-5.8.8/<Module>) throws a warning when working out of /home/me/build/perl-addons/tmp/<Module>.

    So, this allows me to accomplish what I'm trying to do, and even simplifies the process a little but I don't understand why ExtUtils::MakeMaker is behaving this way and why the flags that I was passing in before weren't sufficient.
      Ah, the warning that I was getting about PERL_SRC turned out to be operator error:
      [me@unixbox1:/home/me/build/perl-addons/tmp/HTML-Template-2.8]> perl M +akefile.PL PERL_SRC=/home/me/build/perl/inst/usr/local Checking if your kit is complete... Looks good You cannot build extensions below the perl source tree after executing a 'make clean' in the perl source tree. To rebuild extensions distributed with the perl source you should simply Configure (to include those extensions) and then build perl as normal. After installing perl the source tree can be deleted. It is not needed for building extensions by running 'perl Makefile.PL' usually without extra arguments. It is recommended that you unpack and build additional extensions away from the perl source tree. Warning: PERL_LIB (/home/me/build/perl/inst/usr/local/lib) seems not t +o be a perl library directory (Exporter.pm not found) at /home/me/build/perl/inst/usr/local/ +lib/perl5/5.8.8/ExtUtils/MM_Unix.pm line 1668. Writing Makefile for HTML::Template
      Setting PERL_SRC to /home/me/build/perl/perl-5.8.8 (which is the equivalent path that ExtUtils::MakeMaker was defaulting to when installing CPAN modules from /home/me/build/perl/perl-5.8.8/<Module>) doesn't display that message.

      Now, I'm conflicted. The perldoc for ExtUtils::MakeMaker says that you should only use PERL_SRC if Perl hasn't been installed. I HAVE installed Perl, albeit to a local directory, via make install DESTDIR=/home/me/build/perl/inst. My interpretation of the documentation implies that what I'm doing isn't correct even though it (now) seems to work.