in reply to When you change Perl versions, how do you resync all the CPAN modules you have installed [tag://sysadmin,cpan,modules,upgrade]

Start with perl -V (uppercase "V") and look at the @INC list. When Perl looks for a library, that's where it looks and in what order.

The base list is hard-coded into the Perl module when it is compiled. It customarily includes both site_perl and vendor_perl directories, although distributions do vary as to which one comes first.

An environment variable such as PERL5LIB can be used to insert other paths into the front of this list, and that's what I've chosen to do. For my personal uses of Perl, I've got my personal PERL5LIB list, established by a .bashrc script. (Both Windows and OS/X have comparable mechanisms... see e.g. perldoc perlport.)

I've got "my own, personal" CPAN-setup too, and it has such o conf settings as (I think) PROFILE which cause all of the builds to be directed to the right place. Since these are my personal settings (as reflected in the hidden .cpan directory of my own login account), they affect only me.

When I'm doing system maintenance, my PERL5LIB settings are nowhere in sight: I use an entirely different, more-privileged login for system maintenance that is not "root-ly," and of course I also do use root. None of those see any settings other than the system-default; they use their own .cpan settings in their own home-directories, and those settings are the ones that are established by my distro-vendor (Gentoo).

Incidentally, this mechanism works really well because a lot of my Perl work deals with web-sites. I set up a different login for each web-project for use when I'm working on that one. The settings such as PERL5LIB, and the site-directory structures, are always exactly what needs to be rsync'd up to the corresponding web-site. This keeps the settings for each site at a good arm's-length from one another, as well as from the system. Gentoo can do whatever updates it needs to, and it won't hurt me and I won't hurt them. Likewise, I can make changes needed for client-X which runs on perl-Y on computer-Z without scribbling on the stuff for some other client.

Perl's backers might or might not be adept at advertising (or explaining) all the subtle things they've thought-of, but darned if they didn't think about 'em! Of course, given that Perl runs in as many different environments as it does, you should expect it.