Get a list of perl module names to install

作者:   發佈於:  

From time to time I'm just being lazy to properly declare module dependencies in Makefile.PL, I do this to install required perl modules:

 cpanp -i `grep "^use " -r lib -h |cut -b 5-80|perl -pe 's/[ ;].*$//'|grep -v -E '(utf8|warnings|strict)' | sort | uniq`

This command should work with bash and zsh. Of course it does not cover all cases, it is just a cute, with certain definition of, hack.