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

I have taken great strides ahead with the help of fellow Perl Monks, moving from a no-go ISP to a Cobal RAQ host server! I am using the CPAN module on Linux to install perl modules via SSH. I am using several modules with dependencies and have installed all but one in the following way:
1) Made a lib directory off my home directory.
2) Enter cpan interactive mode.
3) Typed o conf makepl_arg "LIB=~/lib".to pass an argument to perl Makefile.PL.
4) Then install Package::abc..
Many of the modules had dependencies but after I installed the required modules they installed OK. When I try to install DBD::mysql it asks for DBI. I installed DBI successfully and looked to see that DBI.pm is in my ~/lib directory (actually in ~lib/i386-linux). When I install DBD::mysql again it fails to find the package and I get the following:
Warning: prerequisite DBI failed to load: Can't locate DBI.pm in @INC +(@INC contains: /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0 +/usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5. +6.0 /usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_per +l/5.005 /usr/lib/perl5/site_perl .) at (eval 4) line 3.
What I find peculiar is that my ~/lib directory is not in the path. Why did it work for the other modules and not for this one? What is the standard method of resolving dependencies when you do not have root priveleges? Thanks again Perl Monks!

Replies are listed 'Best First'.
•Re: Problem with search path and CPAN install
by merlyn (Sage) on Aug 22, 2002 at 16:26 UTC
    The Perl that invokes CPAN.pm won't know to look in your local directory, because you haven't told it to look there. You've told it to install new things there, but that's an unrelated setting.

    To tell the Perl process that you should also look in that directory for existing modules, it's just like telling any other Perl program:

    • You can add -I~/lib to your command line
    • You can add use lib, as in:
      #!/usr/bin/perl use lib "/path/to/extra/lib"; use CPAN; shell;
    • You can use PERL5LIB, as in
      (for csh-style): PERL5LIB=~/lib export PERL5LIB perl -MCPAN -eshell (for bourne-shell-style): PERL5LIB=~/lib perl -MCPAN -eshell
    But in summary, it's the same steps you'll need to do to all your local programs, because the Perl CPAN installer is just another Perl program!

    -- Randal L. Schwartz, Perl hacker

      Thanks Randal, I've got some digesting to do! Just beats me how I managed to install the other packages yesterday? e.g.
      use Net::POP3; use MIME::QuotedPrint; use MIME::Parser; use DBI; use URI::Escape; use XML::Simple; use Data::Dumper; use Mail::Sender; use MIME::Lite; use MIME::Lite::HTML;

      Quite a few of them had dependencies, then I would install those and then re-install would work? It takes a really (Perl) newbie to confuse a hacker!