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

Hello perlmonks,

I've created a CPAN bundle that I'm now attempting to install in an environment with a current Perl (v5.8.8) build but no CPAN modules. I've ordered the modules in the bundle based on their dependencies. For packaging purposes, I'm attempting to install all modules to a temporary directory. I set my PERL5LIB environment variable to this temporary directory so that subsequent modules can find their dependencies.
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
I start out by upgrading CPAN.pm because the one shipped with Perl v5.8.8 doesn't support Module::Build modules and there are a couple of those in my bundle.
perl -MCPAN -e 'install CPAN'
It launches me into a configuration dialog. I take all the defaults except for the parameters to make install:
Parameters for the 'make install' command? Typical frequently used setting: UNINST=1 to always uninstall potentially conflicting files Your choice: [] DESTDIR=/home/me/build/perl-addons/inst
The install continues and I get dumped back to the prompt. I can verify the CPAN upgrade by doing:
[me@unixbox1:/home/me]> perl -MCPAN -e 'print "$CPAN::VERSION\n"' 1.8802
I then launch the CPAN shell to configure the new Module::Build parameters:
perl -MCPAN -e 'shell'
Again, I take all defaults except for the parameters to ./Build install:
Parameters for the './Build install' command? Typical frequently used setting: --uninst 1 # uninstall conflicting files Your choice: [] --destdir /home/me/build/perl-addons/inst
and then I commit the configuration with:
o conf commit
(Side note: even without going into the shell, CPAN will prompt you for the missing configuration information the next time you use the module, but it won't commit the changes to disk!)

For this discussion, lets say my bundle contains:
Params::Validate MQSeries
although it could be just about anything where later modules have dependencies on the earlier modules.

Params::Validate installs successfully and CPAN launches into the MQSeries config. All's well until:
---- Unsatisfied dependencies detected during [H/HB/HBIERSMA/MQSeries- +1.25.tar.gz] ----- Params::Validate Shall I follow them and prepend them to the queue of modules we are processing right now? [yes]
I know that Params::Validate has been installed; I watched it happen. I can go into another (UNIX) shell, set my PERL5LIB and confirm it:
[me@unixbox1:/home/me]> perl -MParams::Validate -e 'print "$Params::Va +lidate::VERSION\n"' 0.87
Why can't subsequent modules find their dependencies that CPAN just installed?

Replies are listed 'Best First'.
Re: CPAN Bundles and Module Dependencies
by brainsick (Sexton) on Mar 06, 2007 at 14:13 UTC
    I see that the missing CPAN configuration information not being written to disk was reported as a bug.
      You might consider giving the CPANPLUS module a try instead.
Re: CPAN Bundles and Module Dependencies
by xdg (Monsignor) on Mar 06, 2007 at 20:09 UTC

    Can you try breaking this down step by step for us to help us diagnose the problem?

    1. Install just Params::Validate in CPAN::Shell (without using a Bundle)
    2. Confirm actual path to Validate.pm from a Unix shell
    3. In the same Unix shell as CPAN (same PERL5ENV as CPAN saw) check to see if Perl can find Params::Validate.
    4. Install MQSeries in CPAN::Shell (without using a Bundle)

    If all that works, then the problem lies in the Bundle code, so try again from scratch:

    1. Install a bundle with just Params::Validate in CPAN::Shell
    2. Confirm actual path to Validate.pm from a Unix shell
    3. In the same Unix shell as CPAN (same PERL5ENV as CPAN saw) check to see if Perl can find Params::Validate.
    4. Install a bundle with just MQSeries in CPAN::Shell (which should find Params::Validate previously installed)

    Also, in addition, you might also try upgrading CPAN with "Bundle::CPAN" -- a lot of the supporting modules have bug fixes, too.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      Diagnosis:

      1. cpan[2]> install Params::Validate CPAN: Storable loaded ok Going to read /home/me/.cpan/Metadata Database was generated on Wed, 07 Mar 2007 11:09:19 GMT Running install for module Params::Validate Running make for D/DR/DROLSKY/Params-Validate-0.87.tar.gz <snipped a bunch of stuff> Running make install Installing /home/me/build/perl-addons/inst/usr/local/lib/perl5/site_pe +rl/5.8.8/Params/ValidatePP.pm Installing /home/me/build/perl-addons/inst/usr/local/lib/perl5/site_pe +rl/5.8.8/Params/Validate.pm Installing /home/me/build/perl-addons/inst/usr/local/lib/perl5/site_pe +rl/5.8.8/Params/ValidateXS.pm Installing /home/me/build/perl-addons/inst/usr/local/lib/perl5/site_pe +rl/5.8.8/Attribute/Params/Validate.pm Installing /home/me/build/perl-addons/inst/usr/local/share/man/man3/At +tribute::Params::Validate.3 Installing /home/me/build/perl-addons/inst/usr/local/share/man/man3/Pa +rams::ValidatePP.3 Installing /home/me/build/perl-addons/inst/usr/local/share/man/man3/Pa +rams::Validate.3 Installing /home/me/build/perl-addons/inst/usr/local/share/man/man3/Pa +rams::ValidateXS.3 Writing /home/me/build/perl-addons/inst/usr/local/lib/perl5/site_perl/ +5.8.8/sun4-solaris/auto/Params/Validate/.packlist Appending installation info to /home/me/build/perl-addons/inst/usr/loc +al/lib/perl5/5.8.8/sun4-solaris/perllocal.pod /usr/local/bin/make install DESTDIR=/home/me/build/perl-addons/inst +-- OK
      2. (From a different UNIX shell)
        [me@unixbox1:/home/me]> find /home/me/build/perl-addons/inst -name 'Va +lidate.pm' /home/me/build/perl-addons/inst/usr/local/lib/perl5/site_perl/5.8.8/Pa +rams/Validate.pm /home/me/build/perl-addons/inst/usr/local/lib/perl5/site_perl/5.8.8/At +tribute/Params/Validate.pm
      3. (Back to original CPAN shell)
        cpan[4]> ! print $ENV{PERL5LIB} /home/me/build/perl-addons/inst/usr/local/lib/perl5:/home/me/build/per +l-addons/inst/usr/local/lib/perl5/site_perl cpan[4]> ! use Params::Validate; print "$Params::Validate::VERSION\n" Can't locate Params/Validate.pm in @INC (@INC contains: /home/me/build +/perl-addons/inst/usr/local/lib/perl5/5.8.8/sun4-solaris /home/me/bui +ld/perl-addons/inst/usr/local/lib/perl5/5.8.8 /home/me/build/perl-add +ons/inst/usr/local/lib/perl5 /home/me/build/perl-addons/inst/usr/loca +l/lib/perl5/site_perl /usr/local/lib/perl5/5.8.8/sun4-solaris /usr/lo +cal/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 +/home/me) at (eval 27) line 1, <FIN> line 9. BEGIN failed--compilation aborted at (eval 27) line 1, <FIN> line 9.
      I didn't see the point of continuing with the rest of the diagnosis; the issue appears to be that Params::Validate isn't found after it just got done installing. Some additional information:
      cpan[4]> ! use Params::Validate; print $Params::Validate::VERSION Can't locate Params/Validate.pm in @INC (@INC contains: /home/me/build +/perl-addons/inst/usr/local/lib/perl5/5.8.8/sun4-solaris /home/me/bui +ld/perl-addons/inst/usr/local/lib/perl5/5.8.8 /home/me/build/perl-add +ons/inst/usr/local/lib/perl5 /home/me/build/perl-addons/inst/usr/loca +l/lib/perl5/site_perl /usr/local/lib/perl5/5.8.8/sun4-solaris /usr/lo +cal/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 +/home/me) at (eval 27) line 1, <FIN> line 9. BEGIN failed--compilation aborted at (eval 27) line 1, <FIN> line 9. cpan[4]> q Terminal does not support GetHistory. Lockfile removed. [me@unixbox1:/home/me]> perl -MCPAN -e 'shell' Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v1.8802) ReadLine support available (try 'install Bundle::CPAN') cpan[1]> ! use Params::Validate; print "$Params::Validate::VERSION\n" 0.87
      I guess that I don't know how to interpret what I'm seeing. I know it's not working according to my expectations, but is this a bug?

        Interesting. The installer seems to install into site_perl/5.8.8 but your Perl doesn't expand your PERL5LIB the same way.

        # physical file (from #2) /home/me/build/perl-addons/inst/usr/local/lib/perl5/site_per­l/5.8.8/P +arams/Validate.pm # PERL5LIB (from #3) /home/me/build/perl-addons/inst/usr/local/lib/perl5 /home/me­/build/perl-addons/inst/usr/local/lib/perl5/site_perl # Can't find in INC (from #3) # First PERL5LIB path is expanded # Second is not /home/me/build/perl-addons/inst/usr/local/lib/perl5/5.8.8/su­n4-solari +s /home/me/build/perl-addons/inst/usr/local/lib/perl5/5.8.8 /home/me/build/perl-addons/inst/usr/local/lib/perl5 /home/me/build/perl-addons/inst/usr/local/lib/perl5/site_per­l

        Off the top of my head, I'm not sure why your site_perl in PERL5LIB isn't being expanded with the version number. Maybe something in how your Perl was configured?

        What is the output of perl -V?

        -xdg

        Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: CPAN Bundles and Module Dependencies
by andk (Novice) on Mar 08, 2007 at 13:42 UTC
    Would you mind installing ANDK/CPAN-1.88_78.tar.gz so we do not chase a bug that probably is fixed already? I'd appreciate if you could. Offhand I cannot see where it might go wrong, seems to be a really subtle problem. I'll stare a bit longer into the code and try to reproduce what you have.
      Still having the issue.
      [me@unixbox1:/home/me]> cat ~/.cpan/CPAN/MyConfig.pm $CPAN::Config = { 'auto_commit' => q[0], 'build_cache' => q[10], 'build_dir' => q[/home/me/.cpan/build], 'cache_metadata' => q[1], 'commandnumber_in_prompt' => q[1], 'cpan_home' => q[/home/me/.cpan], 'ftp' => q[/usr/bin/ftp], 'ftp_passive' => q[1], 'ftp_proxy' => q[], 'getcwd' => q[cwd], 'gpg' => q[], 'gzip' => q[/usr/bin/gzip], 'histfile' => q[/home/me/.cpan/histfile], 'histsize' => q[100], 'http_proxy' => q[], 'inactivity_timeout' => q[0], 'index_expire' => q[1], 'inhibit_startup_message' => q[0], 'keep_source_where' => q[/home/me/.cpan/sources], 'lynx' => q[], 'make' => q[/usr/local/bin/make], 'make_arg' => q[], 'make_install_arg' => q[DESTDIR=/home/me/build/cpantest/inst], 'make_install_make_command' => q[/usr/local/bin/make], 'makepl_arg' => q[], 'mbuild_arg' => q[], 'mbuild_install_arg' => q[--destdir /home/me/build/cpantest/inst], 'mbuild_install_build_command' => q[./Build], 'mbuildpl_arg' => q[], 'ncftp' => q[], 'ncftpget' => q[], 'no_proxy' => q[], 'pager' => q[/usr/bin/less], 'prerequisites_policy' => q[ask], 'scan_cache' => q[atstart], 'shell' => q[/usr/bin/tcsh], 'tar' => q[/usr/local/bin/tar], 'term_is_latin' => q[1], 'term_ornaments' => q[1], 'unzip' => q[/usr/bin/unzip], 'urllist' => [q[ftp://cpan.llarian.net/pub/CPAN/], q[ftp://ftp.cise. +ufl.edu/pub/mirrors/CPAN/], q[ftp://mirror.candidhosting.com/pub/CPAN +], q[ftp://perl.secsup.org/pub/perl/], q[http://cpan.mirrors.hoobly.c +om/]], 'use_sqlite' => q[0], 'wget' => q[/usr/local/bin/wget], }; 1; __END__ [me@unixbox1:/home/me]> perl -MCPAN -e 'print "$CPAN::VERSION\n"' 1.8878 [me@unixbox1:/home/me]> echo $PERL5LIB /home/me/build/cpantest/inst/usr/local/lib/perl5:/home/me/build/cpante +st/inst/usr/local/lib/perl5/site_perl [me@unixbox1:/home/me]> perl -MCPAN -e 'shell' Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v1.8878) ReadLine support available (try 'install Bundle::CPAN') cpan[1]> install Params::Validate CPAN: Storable loaded ok (v2.15) Going to read /home/me/.cpan/Metadata Database was generated on Thu, 08 Mar 2007 12:08:29 GMT Running install for module 'Params::Validate' Running make for D/DR/DROLSKY/Params-Validate-0.88.tar.gz LWP not available CPAN: Net::FTP loaded ok (v2.75) Fetching with Net::FTP: ftp://cpan.llarian.net/pub/CPAN/authors/id/D/DR/DROLSKY/Params-Valid +ate-0.88.tar.gz CPAN: checksum security checks disabled because Digest::SHA not inst +alled. Please consider installing the Digest::SHA module. Scanning cache /home/me/.cpan/build for sizes ...................................................................... +......DONE Params-Validate-0.88/ Params-Validate-0.88/t/ Params-Validate-0.88/t/24-tied.t Params-Validate-0.88/t/13-taint.t Params-Validate-0.88/t/18-depends.t Params-Validate-0.88/t/with.pl Params-Validate-0.88/t/08-noop_with.t Params-Validate-0.88/t/22-overload-can-bug.t Params-Validate-0.88/t/10-noop_regex.t Params-Validate-0.88/t/03-attribute.t Params-Validate-0.88/t/defaults.pl Params-Validate-0.88/t/callbacks.pl Params-Validate-0.88/t/07-with.t Params-Validate-0.88/t/16-normalize.t Params-Validate-0.88/t/27-string-as-type.t Params-Validate-0.88/t/regex.pl Params-Validate-0.88/t/23-readonly.t Params-Validate-0.88/t/tests.pl Params-Validate-0.88/t/26-isa.t Params-Validate-0.88/t/12-noop_cb.t Params-Validate-0.88/t/05-noop_default.t Params-Validate-0.88/t/21-can.t Params-Validate-0.88/t/04-defaults.t Params-Validate-0.88/t/19-untaint.t Params-Validate-0.88/t/02-noop.t Params-Validate-0.88/t/25-undef-regex.t Params-Validate-0.88/t/01-validate.t Params-Validate-0.88/t/11-cb.t Params-Validate-0.88/t/15-case.t Params-Validate-0.88/t/17-callbacks.t Params-Validate-0.88/t/14-no_validate.t Params-Validate-0.88/t/06-options.t Params-Validate-0.88/t/09-regex.t Params-Validate-0.88/Changes Params-Validate-0.88/lib/ Params-Validate-0.88/lib/Params/ Params-Validate-0.88/lib/Params/ValidateXS.pm Params-Validate-0.88/lib/Params/ValidatePP.pm Params-Validate-0.88/lib/Params/Validate.pm Params-Validate-0.88/lib/Attribute/ Params-Validate-0.88/lib/Attribute/Params/ Params-Validate-0.88/lib/Attribute/Params/Validate.pm Params-Validate-0.88/MANIFEST Params-Validate-0.88/TODO Params-Validate-0.88/META.yml Params-Validate-0.88/ppport.h Params-Validate-0.88/Validate.xs Params-Validate-0.88/LICENSE Params-Validate-0.88/Makefile.PL Params-Validate-0.88/README CPAN: File::Temp loaded ok (v0.16) CPAN.pm: Going to build D/DR/DROLSKY/Params-Validate-0.88.tar.gz Testing if you have a C compiler ld: fatal: file test.o: unknown file type ld: fatal: File processing errors. No output written to test.o I cannot determine if you have a C compiler so I will install a perl-only implementation You can force installation of the XS version with perl Makefile.PL --xs Checking if your kit is complete... Looks good Writing Makefile for Params::Validate Could not read '/home/me/.cpan/build/Params-Validate-0.88-gbowGo/META. +yml'. Falling back to other methods to determine prerequisites cp lib/Params/ValidatePP.pm blib/lib/Params/ValidatePP.pm cp lib/Attribute/Params/Validate.pm blib/lib/Attribute/Params/Validate +.pm cp lib/Params/Validate.pm blib/lib/Params/Validate.pm cp lib/Params/ValidateXS.pm blib/lib/Params/ValidateXS.pm Manifying blib/man3/Attribute::Params::Validate.3 Manifying blib/man3/Params::ValidatePP.3 Manifying blib/man3/Params::Validate.3 Manifying blib/man3/Params::ValidateXS.3 DROLSKY/Params-Validate-0.88.tar.gz /usr/local/bin/make -- OK Warning (usually harmless): 'YAML' not installed, will not store persi +stent state Running make test PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" " +test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01-validate............ok t/02-noop................ok t/03-attribute...........ok t/04-defaults............ok t/05-noop_default........ok t/06-options.............ok t/07-with................ok t/08-noop_with...........ok t/09-regex...............ok t/10-noop_regex..........ok t/11-cb..................ok t/12-noop_cb.............ok t/13-taint...............ok t/14-no_validate.........ok t/15-case................ok t/16-normalize...........ok t/17-callbacks...........ok t/18-depends.............ok t/19-untaint.............skipped all skipped: These tests require Test::Taint 0.02+ to run t/21-can.................ok t/22-overload-can-bug....ok t/23-readonly............skipped all skipped: Need Readonly::XS and Readonly for this test t/24-tied................ok 4/6 skipped: various reasons t/25-undef-regex.........ok t/26-isa.................ok t/27-string-as-type......ok All tests successful, 2 tests and 4 subtests skipped. Files=26, Tests=504, 15 wallclock secs ( 6.76 cusr + 2.80 csys = 9.5 +6 CPU) DROLSKY/Params-Validate-0.88.tar.gz /usr/local/bin/make test -- OK Warning (usually harmless): 'YAML' not installed, will not store persi +stent state Running make install Installing /home/me/build/cpantest/inst/usr/local/lib/perl5/site_perl/ +5.8.8/Params/ValidatePP.pm Installing /home/me/build/cpantest/inst/usr/local/lib/perl5/site_perl/ +5.8.8/Params/Validate.pm Installing /home/me/build/cpantest/inst/usr/local/lib/perl5/site_perl/ +5.8.8/Params/ValidateXS.pm Installing /home/me/build/cpantest/inst/usr/local/lib/perl5/site_perl/ +5.8.8/Attribute/Params/Validate.pm Installing /home/me/build/cpantest/inst/usr/local/share/man/man3/Attri +bute::Params::Validate.3 Installing /home/me/build/cpantest/inst/usr/local/share/man/man3/Param +s::ValidatePP.3 Installing /home/me/build/cpantest/inst/usr/local/share/man/man3/Param +s::Validate.3 Installing /home/me/build/cpantest/inst/usr/local/share/man/man3/Param +s::ValidateXS.3 Writing /home/me/build/cpantest/inst/usr/local/lib/perl5/site_perl/5.8 +.8/sun4-solaris/auto/Params/Validate/.packlist Appending installation info to /home/me/build/cpantest/inst/usr/local/ +lib/perl5/5.8.8/sun4-solaris/perllocal.pod DROLSKY/Params-Validate-0.88.tar.gz /usr/local/bin/make install DESTDIR=/home/me/build/cpantest/inst -- +OK Warning (usually harmless): 'YAML' not installed, will not store persi +stent state cpan[2]> ! use Params::Validate; print "$Params::Validate::VERSION\n" Can't locate Params/Validate.pm in @INC (@INC contains: /home/me/build +/cpantest/inst/usr/local/lib/perl5/5.8.8/sun4-solaris /home/me/build/ +cpantest/inst/usr/local/lib/perl5/5.8.8 /home/me/build/cpantest/inst/ +usr/local/lib/perl5 /home/me/build/cpantest/inst/usr/local/lib/perl5/ +site_perl /usr/local/lib/perl5/5.8.8/sun4-solaris /usr/local/lib/perl +5/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 /home/me) at + (eval 25) line 1, <FIN> line 2. BEGIN failed--compilation aborted at (eval 25) line 1, <FIN> line 2. cpan[2]> ! print "$ENV{PERL5LIB}\n" /home/me/build/cpantest/inst/usr/local/lib/perl5:/home/me/build/cpante +st/inst/usr/local/lib/perl5/site_perl cpan[2]> ! print join "\n", @INC /home/me/build/cpantest/inst/usr/local/lib/perl5/5.8.8/sun4-solaris /home/me/build/cpantest/inst/usr/local/lib/perl5/5.8.8 /home/me/build/cpantest/inst/usr/local/lib/perl5 /home/me/build/cpantest/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 /home/me
        Thanks brainsick,

        I've now posted to perl5-porters for advice. I found a smaller demonstration case that does not need CPAN.pm to illustrate the border case. Please read the posting with the title "Composing @INC from PERL5LIB". Sorry, I have no link yet but I suppose the article will appear on google groups in less than an hour.

        I'll keep you posted once a consensus has been reached over there.

        For now the workaround for you would be to create the installation directory before starting the CPAN shell. Then perl will compute @INC as desired.

        Thanks for your excellent bugreport!