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
Possibly-Related Posts

Comment

Leave a comment . . .

Tiny Print:

  1. For private messages, e-mail me: dannyman@toldme.com.
  2. You must provide an e-mail address.
  3. You can use a bogus e-mail address, but I like to know who you are.
  4. I will not spam you. I will not publish or share your e-mail address.
  5. First-time commenters will be held for review.
  6. You can use these HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>