Title: Message
Alright,  so further reading has shown that Perl always steps through @INC from the front,
and always uses a module from the first place it finds it.
 
This means that 'Extutils::Installed.pm' and 'perl_modules_installed' are correctly showing
the installed version of List::Util as 1.07_00.
 
But could someone please explain to me why 'cpan> install List::Util' installs version
1.11 into a directory where it will never be used.
 
Am I missing something fundamental?   Is there some documentation I should have read, but haven't?
 
How do other people handle the updating of Standard modules?
 
Regards,
Paul
 
-----Original Message-----
From: Keirnan, Paul
Sent: Thursday, 7 August 2003 5:28 PM
To: [EMAIL PROTECTED]
Subject: [Perl-unix-users] CPAN recommendations are wonky -- or is it me

CPAN still shows installed version as 1.07_00 after installing latest version (1.11).

This happens for any module which is part of the original 5.8.0 build.

@INC contains:
[EMAIL PROTECTED]:> perl -e 'for $l (@INC) { print "$l\n"; }'
/usr/local/lib/perl5/5.8.0/alpha-dec_osf
/usr/local/lib/perl5/5.8.0
/usr/local/lib/perl5/site_perl/5.8.0/alpha-dec_osf
/usr/local/lib/perl5/site_perl/5.8.0
/usr/local/lib/perl5/site_perl
.

After using CPAN to 'install List::Util' I have the original in
    /usr/local/lib/perl5/5.8.0/List…
and the newly installed version in
    /usr/local/lib/perl5/site_perl/5.8.0/alpha-dec_osf/List

I take it that it is intended functionality that these updates do not overwrite
the originals.

So I also take it that when looking for a module Perl either
  searches @INC forwards (all directories) and uses the last match found
or
  searches @INC backwards and uses the first match found. 

^^^^^^^^^^^^^ That was wrong ^^^^^^^^^^^^^^^^ 

However…….

cpan> r
Package namespace         installed    latest  in CPAN file
List::Util                  1.07_00      1.11  G/GB/GBARR/Scalar-List-Utils-1.11.tar.gz

[EMAIL PROTECTED]:> grep 'VERSION' /usr/local/lib/perl5/5.8.0/List/Util.pm
our $VERSION   = "1.07_00";
...

[EMAIL PROTECTED]:> grep 'VERSION' /usr/local/lib/perl5/site_perl/5.8.0/alpha-dec_osf/List/Util.pm
$VERSION    = "1.11";
...

Running 'perl_modules_installed' also shows the installed version as 1.07_00.

This is because in ExtUtils:Installed.pm we have:

        # Find the top-level module file in @INC
        $self->{$module}{version} = '';
        foreach my $dir (@INC) {
            my $p = File::Spec->catfile($dir,$modfile);
            if (-f $p) {
                require ExtUtils::MM;
                $self->{$module}{version} = MM->parse_version($p);
                last;
            }
        }

The 'last' means that the version is retrieved from the first file found in @INC.

Commenting out the 'last' makes 'perl_modules_installed' behave as I would expect,
but 'cpan> r' still shows 1.07_00.

Am I misunderstanding something, or am I right in expecting 'perl_modules_installed'
and 'cpan> r' to show "1.11" for this module.

Regards,
Paul

**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************
**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************

Reply via email to