http://www.perlmonks.org?node_id=666160


in reply to Local CPAN modules

Been there, done that. :-)

What I do is simply do this:

  1. Untar everything (check if it's untarred already)
  2. Loop:
    1. If Build.PL exists:
      • Run $^X -I$install_base/lib Build.PL --install_base $install_base, and catch the output.
      • Check for /ERROR: Prerequisite (\S+) isn't installed/. If found, go to next item in loop.
      • Run $^X Build install (if failed, go to next item)
      • Delete current build from to-do hash.
      else if Makefile.PL exists:
      • Run $^X -I$install_base/lib Makefile.PL LIB=$install_base/lib PREFIX=$install_base, and catch the output.
      • Check for /prerequisite\s*(\S+)\s.*not found/. If found, go to next item in loop.
      • Run make install (if failed, go to next item)
      • Delete current build from to-do hash.
  3. After each iteration of the loop, if the size of the to-do hash is non-zero and hasn't changed (meaning some prereqs may not be satisfied, or some installs failed), bail. (This is important :->)
Obviously, I do this in perl. I don't even want to know how to do it in make - at least, automatically, that is. If it were in make, I'd just set up a bunch of targets where "DBD-mySQL: DBI" or something ... but that sounds painful, too :-)