freddo411 has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed Monks,

I'm moving a CGI application I've written to a new machine. I'm on a protected intranet so I can't get to CPAN directly. I have what I thought was a very small number of modules that are needed. Unfortuantately, their dependencies add up to a lot of modules, enough that I'm getting really annoyed tracking them down and installing them by hand.

I need a better solution to this problem. I can envision a couple of solutions. The one at the top of my list would be to "install" all my needed modules in a seperate directory near my app and modify @INC to use this path. Then when I was ready to package it up, I could just copy the directory ( I'm targeting an identical an OS/Hardware /Perl version platform.)

my Questions:

** How can I find all used modules and their dependencies?

** Specifically, when building a module, how can I tell it where to install?



I'm also interested in related wisdom, other approaches for example...

thanks

-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday

  • Comment on Bundling Several Modules and their dependents

Replies are listed 'Best First'.
Re: Bundling Several Modules and their dependents
by Fletch (Bishop) on Oct 01, 2003 at 00:04 UTC
Re: Bundling Several Modules and their dependents
by clscott (Friar) on Oct 01, 2003 at 01:58 UTC
    1. Finding Dependancies

      You can use CPAN to make an autobundle of all the modules installed in your original ( current) perl build. Or you can try Module::Dependency from CPAN to get a list of file dependancies. You might also look into CPANPLUS as an option if you're able to build on a machine with internet access. CPANPLUS makes it easy to install modules with many dependancies.

    2. Installing modules to custom directories

      You need to specify all of these on the command like when performing a manual build ( perl Makefile.PL PREFIX=...).Most modules only need a few of these but I've found that some will need different ones so I set them all:

      PREFIX=$PREFIX \ INSTALLPRIVLIB=$PREFIX/lib/perl5 \ INSTALLSCRIPT=$PREFIX/bin \ INSTALLSITELIB=$PREFIX/lib/perl5/site_perl \ INSTALLBIN=$PREFIX/bin \ INSTALLMAN1DIR=$PREFIX/lib/perl5/man \ INSTALLMAN3DIR=$PREFIX/lib/perl5/man/man3
      This is documented in perlmodinstall

      I actually keep that snippet in a shell script, like this:

      #!/bin/sh export PREFIX=$HOME/usr/local echo PREFIX=$HOME/usr/local \ INSTALLPRIVLIB=$PREFIX/lib/perl5 \ INSTALLSCRIPT=$PREFIX/bin \ INSTALLSITELIB=$PREFIX/lib/perl5/site_perl \ INSTALLBIN=$PREFIX/bin \ INSTALLMAN1DIR=$PREFIX/lib/perl5/man \ INSTALLMAN3DIR=$PREFIX/lib/perl5/man/man3
      So that $HOME and $PREFIX will be interpreted and then I do: perl Makefile.PL `localperl.sh`

      Or CPANPLUS will let you setup these variables in its configuration if you decide to go that route.

    3. Moving Modules to another machine

      You should be able to just copy the top level directory to another machine provide the architechures and perl builds are identical or if they are all pure perl modules.

    4. Adding to @INC or Custom Library paths

      You can edit an environment variable called PERL5LIB. Directories added here will automatically be added to @INC in all of your scripts.

      It is documented in perlrun

    These are techniques that have worked for me, your mileage may vary.

    --
    Clayton