Fork me on github!!

How To Reinstall All Modules On New Perl

Sometimes when you install a new perl version, you want to put all the modules you were using on a previous version onto your new perl install.

You can easily get the list of modules in the current perl installation with list-modules command:

perlbrew use perl-5.8.8@foo-project
perlbrew list-modules

That simply prints out module names that you can use latter.

This one-liner can install everything in that output to a diferrent perl installation:

perlbrew list-modules | perlbrew exec --with perl-5.16.2@foo-project cpanm

The exec command is particularly helpful to run any program as if it is in the environment of the specified perl installations. Understand it more by running perlbrew help exec.