in reply to Why does the CPAN module upgrade to perl 5.6?
I use the following (very crude) script (which I call "cpan") that automatically switches ~/.cpan directories depending on the version of Perl you are using (I used this more often when I was in the process of switching to 5.6, so I still used 5.005 stuff often). I have two directories called .cpan-5.005 and .cpan-5.6.0 in my home directory, and links called .cpan-5.00502 and .cpan-5.006 (which is what the $] variable returns under my two installed versions of perl) that point to them. Then the cpan script creates a link called .cpan that points to the corresponding directory, before actually executing the CPAN module.
eval 'exec perl -x $0 ${1+"$@"}' # -*-perl-*- if 0; #!perl -w # # A version of the cpan command that changes the ~/.cpan link to the # appropriate directory depending on which version of perl we are # running. # Diego Zamboni, June 6, 2000 # $Id$ use strict; eval "use Coy"; my $BASE=$ENV{HOME}; my $LINK="$BASE/.cpan"; # Only proceed if $LINK does not exist or it is a symlink if (-e $LINK && ! -l $LINK) { die "$LINK is not a symlink. Cannot proceed\n"; } if (-e $LINK) { unlink($LINK) or die "Error removing $LINK: $!\n"; } # Check if the directory corresponding to our version of perl exists. my $NEWNAME="$BASE/.cpan-$]"; unless (-l $NEWNAME || -d $NEWNAME) { die "$NEWNAME does not exist. Cannot proceed\n"; } symlink($NEWNAME, $LINK) or die "Error linking $NEWNAME to $LINK: $!\n +"; use CPAN; shell;
--ZZamboni
|
|---|