CPAN modules should always be properly built. Just tossing essential components into a directory subverts a lot of "goings-on" that are supposed to happen upon installation. While you may be successful moving components into directories by hand, you will be missing one of the most important steps: the test suite run. Without the test suite running you have no way of being sure that you didn't miss something. Imagine an XS need that only occurs under specific circumstances. You would have to read the entire source and understand it to be sure you're not missing something that the tests could prove for you automatically.
When a module is properly built, several things happen:
- The manifest list is checked. This is a list that comes with the module. It ensures you've got all the components you need.
- The module is tested with the module author's test suite. This assures that the module works on your system properly (which includes verifying that you have all needed components and dependencies). Ok, "assures" is a strong assertion, but at least "verifies that the modules passes the test suite on your system."
- Compiles supporting XS code if necessary.
- Creates an appropriate directory structure for the module and places it there so Perl knows where to find it.
Other things may happen too; that's dependent on what the module's author wrote into his installation suite. But those are the basics, and aren't in exact order.
At minimum download the module's tarball, unpack it into a temporary folder, cd into the folder, and type:
perl Makefile.PL
make
make test
make install
There are some modules built with Module::Build instead, and for those, it's:
perl Build.PL
Build
Build test
Build install
Nowadays people often just use cpan, CPANPLUS, or cpanm (CPAN minus) to install modules along with their dependencies for them. But occasionally you'll have to use the manual approach as described above.
Though you can install via apt-get install any of the Perl modules your Linux (Debian/Ubuntu) distro has available to it, they will install to your system Perl, which leads me to the next topic.
It's generally considered more trouble than worth to upgrade your system Perl independent of OS upgrades, or to bother with installing modules to system-Perl, unless you absolutely have to. People are using perlbrew to set up a local copy of Perl that is independent of the system Perl. Perlbrew makes it easy to switch between multiple installations of Perl. It will also cause your module installations to target the Perlbrew Perl installations rather than system Perl. That way you don't have to worry about installing something that interferes with how your operating system expects Perl to behave, while at the same time gaining the ability to upgrade at will, and install modules at will to this independent Perl install.
I've got one Perl build that I use for just about everything now, and then a few alternates that I use for testing under alternate versions or configurations. Perlbrew facilitates the entire process.
Once you've got your new Perl installation configured, you can install new modules just by typing cpan Module::Name. Then the module is fetched from CPAN, built, tested, and installed. Dependencies are handled automatically in most cases.
|