By Hand
People don’t often install CPAN distributions by hand since they would have to handle all of the dependencies themselves, which is too much work. You can do it, though, and it’s useful to know how.
When you look inside the distribution, you’ll probably find a Makefile.PL or a Build.PL. You use them in the same way, as shown in Table 19-1.
Table 19-1. Build commands for the two major build tools
Makefile.PL | Build.PL |
|---|---|
|
|
With the defaults, both build systems try to install the distribution in the library paths you (or someone) set up when they built and installed the perl binary you used to run the build file. You can see those directories at the end of the output of perl –V.
You may not have permission to write into those directories, but you can install modules in any directory you please by telling build file where to install them. Build files change their behavior based on command-line options or environment variables.
% perl Makefile.PL INSTALL_BASE=/some/other/directory% perl Build.PL ––install_base /some/other/directory
You don’t have to specify the options every time if you set them in the right environment variables. Each build system has an environment variable to hold default command-line options. Here’s how you’d do it in a /bin/sh environment:
% export PERL_MM_OPT='INSTALL_BASE=/some/other/directory'% export PERL_MB_OPT='––install_base /some/other/directory'
And here’s ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access