dannyman.toldme.com


Technical

Which Perl Modules are Missing?

Q: How to list which Perl modules may be missing from a script?

A: cat <name-of-script> | awk '$1 == "use" {print "perl -e \"use "$2"\" 2> /dev/null || echo "$2}' | sh

Q: Er, so, can I auto-install?

A: Well, I prefer to rely on the packaging services of the local OS, but in a pinch this ought to work mostly:

cat <name-of-script> | awk '$1 == "use" {print "perl -e \"use "$2"\" 2> /dev/null || cpan -i "$2}' | sh

Also useful for tracking down dependencies: I was reminded that for FreeBSD, what I would wish to call pkg_which is pkg_info -W, which will tell you what package a file came from.

Read More

Next:
Previous:
Categories: Technical

Discover more from dannyman.toldme.com

Subscribe now to keep reading and get access to the full archive.

Continue reading