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

Dear Monks,

I am trying to figure out how I got caught by a strange module install issue and how to prevent it in the future. About a year ago I installed module Test::SDK (which doesn't seem to be around any more).

Tue Nov 27 11:31:59 2001: "Module" Test · "installed into: /usr/lib/perl5/5.6.1" · "LINKTYPE: dynamic" · "VERSION: 1.18" · "EXE_FILES: " Tue Nov 27 11:32:07 2001: "Module" Test::SDK · "installed into: /usr/lib/perl5/5.6.1" · "LINKTYPE: dynamic" · "VERSION: 0.04" · "EXE_FILES: "

The Test::SDK bundle included Test-Simple-0.19. Today, I tried to upgrade to Test-Simple-0.47.

Thu Dec 5 13:17:35 2002: "Module" Test::Simple · "installed into: /usr/lib/perl5/site_perl/5.6.1" · "LINKTYPE: dynamic" · "VERSION: 0.47" · "EXE_FILES: "

This install went to /usr/lib/perl5/site_perl/5.6.1, instead of to /usr/lib/perl5/5.6.1. Since the latter is earlier on my @INC path, the upgrade didn't work until I deleted the earlier modules.

My question is, what can I do to prevent being caught when CPAN moves modules around like this? I have a little script I used to find the problem once I realized it, which might be a starting point.

use strict; if ($#ARGV < 0) { die "Usage: which.pl fname\n"; } my $fname = $ARGV[0]; my $dir; foreach $dir (@INC) { print "Checking $dir\n"; if (-e "$dir/$fname") { print "Found $dir/$fname\n"; } }

Replies are listed 'Best First'.
Re: Installed CPAN modules misdirected
by tall_man (Parson) on Dec 05, 2002 at 21:28 UTC
    I just found a thread about this particular case on a perl mail archive, starting at this location

    At least it explains why Test::SDK has disappeared.

Re: Installed CPAN modules misdirected
by grantm (Parson) on Dec 05, 2002 at 23:10 UTC

    CPAN::Config has a parameter 'make_install_arg' which is the list of parameters to pass to make (and it defaults to nothing). I think if you include the parameter 'UNINST=1' then 'make install' will locate and remove other versions of modules which conflict with the one you're installing.

    But I might be completely wrong about that.

Re: Installed CPAN modules misdirected
by strider corinth (Friar) on Dec 06, 2002 at 18:34 UTC
    This is an excerpt from the ExtUtils::MakeMaker module. MakeMaker is the module used to generate Makefile.PLs for module installations. I prefer putting new modules in site_perl, myself, but if you want to keep your environment homogeneous, you could use the LIB attribute (I also include PREFIX 'cause you might find it useful):
    PREFIX and LIB attribute PREFIX and LIB can be used to set several INSTALL* attributes in one go. The quickest way to install a module in a non-standard place might be perl Makefile.PL PREFIX=~ This will install all files in the module under your home directory, with man pages and libraries going into an appropriate place (usually ~/man and ~/lib). Another way to specify many INSTALL directories with a single parameter is LIB. perl Makefile.PL LIB=~/lib

    --
    Love justice; desire mercy.