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;