Bracing against the wind  

Friday, January 15, 2010

List all perl modules that can be yum installed

I have to do this from time to time. Handy way to list all the perl modules needed to install. Useful when upgrading perl or building a new box.

List all modules needed by all code in the current directory:

grep "^use [A-Z]" * | perl -pe 's/\r//g; s/.*?:use //; s/ .+//; s/;[ \t]*$//;' | sort | uniq

Same as above, but massaged and piped to yum provides:

grep "^use [A-Z]" * | perl -pe 's/\r//g; s/.*?:use //; s/ .+//; s/;[ \t]*$//;' | \
sort | uniq | perl -pe 's/(.*)/perl($1)/' | \
xargs yum provides | grep -E '^([1-9]:)?perl' | perl -pe 's/^[1-9]://; s/ :.*//; s/-[0-9].*?$//' | \
grep -v perl$ | sort | uniq

Suitable for piping to xargs yum install....


[View/Post Comments] [Digg] [] [Stumble]

Home | Email me when this weblog updates: | View Archive

(C) 2002 Erik Aronesty/DocumentRoot.Com. Right to copy, without attribution, is given freely to anyone for any reason.

Listed on BlogShares | Bloghop: the best pretty good | Blogarama | Technorati | Blogwise