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.
Comment
Tiny Print:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>