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

I've noticed recently that the CPAN module has taken to upgrading my perl installations to perl 5.6.0

The last time it happened I was installing DBI I think using the CPAN shell. Eg :-

perl -MCPAN -eshell > install DBI
I think the dependency that caused it was something simple like IO::Socket but I'm not 100% sure (I find the CPAN module somewhat mysterious in this respect).

I've seen this happen a few times recently - does anyone know why? Is is a bug, or did I really need to upgrade?

Replies are listed 'Best First'.
Re: Why does the CPAN module upgrade to perl 5.6?
by ZZamboni (Curate) on Aug 17, 2000 at 01:54 UTC
    This has happened a couple of times to me, but I can't pinpoint the reason. I would suggest making sure that "perl" runs the version of Perl you want, and that you don't have environment variables (like PERLLIB or PERL5LIB) that point to places with 5.6 modules). Also, make sure that you are not sharing CPAN.pm configuration information between different versions of Perl. This could happen if you have used the 5.6 version of CPAN.pm (which may have updated stuff in your ~/.cpan directory) and then try to use the 5.005 version of CPAN.pm with the same configuration directory.

    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

RE (tilly) 1: Why does the CPAN module upgrade to perl 5.6?
by tilly (Archbishop) on Aug 17, 2000 at 02:55 UTC
    Upgrade your CPAN module.

    The reason why is that CPAN checks dependencies, so if you go to install something that requires an upgrade in something else, that requires an upgrade in another thing, well CPAN will try to upgrade the whole chain. In your case something along the line requires Perl 5.6. I complained about that, and current versions of CPAN will fail rather than do that upgrade.

    Given the current state of 5.6 I would start complaining to the module authors about the dependencies. And in general Perl is likely in need of a better versioning system. But that is a discussion for the Perl 6 folks.

      I think an even more common reason is a bit of a bug in CPAN. The problem occurs when the newest version of a module on CPAN is contained in the full Perl distribution.

      Some authors of modules that are included in the Perl distribution try to make a new version after (or just before) a major release of Perl. That way CPAN will fetch the "newer" (but identical other than version number) release of the module instead of asking you if you want to install all of the standard Perl distribution in order to get one module.

              - tye (but my friends call me "Tye")
RE: Why does the CPAN module upgrade to perl 5.6?
by coreolyn (Parson) on Aug 17, 2000 at 15:31 UTC

    I hope this isn't an annoying double post but my first one doesn't seem to have posted... strange.

    Anyway, According to whoever is at the other end of the cpan site email (I don't have the email here). The upgrading of perl is a bug NOT a feature. Upgrading to the latest CPAN.pm will fix this. Note: I looked up the email the name from CPAN that provided the information was 'Elaine-HFB-Ashtor'.

    coreolyn Duct tape devotee.

Re: Why does the CPAN module upgrade to perl 5.6? (a work-around)
by markjugg (Curate) on Jun 22, 2001 at 02:38 UTC
    I was updating Bundle::CPAN and I ran into this.

    I worked around this like this:

    I used Control-C to cancel the CPAN update process when I saw Perl 5.6.1 coming down. I then finished the installation manually:

    cd /root/.cpan/build/CPAN-1.59
    make
    make install
    
    That seemed to work fine.

    -mark