How to move all CPAN installations from one perl version to another?

cpan as a built-in option for this purpose. First, create a bundle of all existing packages. For this, load the older perl version which will be the source for all cpan modules:

module load perl/5.22.1
perl -MCPAN -eautobundle

This will print all the CPAN modules that it puts in the bundle. Once complete, you’ll see:

Wrote bundle file
    /path/to/current/dir/Snapshot_2017_05_09_00.pm

Now, unload the older perl and load newer perl:

module purge
module load perl/5.24.0

And install modules:

perl -MCPAN -e 'install Bundle::Snapshot_2017_05_09_00'

It should install all CPAN modules in the bundle!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s