Install all used modules at once

作者:   發佈於:  

Ever since perlbrew was made useful, switching among different versions of perl makes it painful to re-install the required modules over and over. That's why I wrote this module-used program to rescue me.

The usage of module-used is heavily inspired by tokuhirum++'s cpan-outdated program:

cd /to/my/awesome-project
module-used

That gives you a list of module names which are found to be used in some source files under current directory. It can then be piped to xargs cpan -i to perform bulk module installation:

module-used | xargs cpan -i
module-used | xargs cpanm

Although cpanm --installdeps is doing basically the same thing here, this program is also helpful for module authors to get a list of names for their Makefile.PL or Build.PL, which might not be there in the first place if the current project is not planed to be uploaded to CPAN.

The module-used program itself uses Module::ExtractUse and List::MoreUtils , install them first, and the the program should be ready to run.