|Perl Monk, Perl Meditation|
Leveraging Debian for Module Managementby jwest (Friar)
|on Dec 20, 2001 at 01:39 UTC||Need Help??|
For those of you who run Debian GNU/Linux, a relatively obscure package could make your life a lot easier.
To begin, you'll want to install the package 'dh-make-perl'. It's a perl script that quickly builds .deb's from CPAN sources. How cool is that? The remainder of this meditation deals with how to use dh-make-perl, and assumes you have basic skills with dpkg and/or apt.
The obvious question is "Why would I want to do this to begin with?" There are already standards- easy ones at that- for installing Perl modules. You probably already know how to use the shell mode of the CPAN module, or are very familiar with the usual perl Makefile.PL; make; make test; make install method of module installation. What this aims to do, however, is go beyond just installation and let you get into module management.
Have you ever wanted to get rid of a module? Hunting down the files in each directory can be a tedious task at best, and a real chore for someone who does this less often. Using dh-make-perl makes these tasks as simple as managing any other Debian package, and the standard Debian tools (dpkg and apt) will work against it.
Upgrades are handled as you would expect as well. When the new version of Net::Netmask comes out, and you want to replace the currently installed version, you can convert it to a .deb, install it, and through the magic of dpkg, the old one is removed completely from your system.
Of course, you're not limited to CPAN modules, either. Your own modules will be bundled up quite nicely provided they've got the requisite materials accompanying them.
As it is with Perl, it is with dh-make-perl- TIMTOWTDI. I prefer to do a lot of the building by hand, but you might choose to let dh-make-perl automate more of it than I'm comfortable with. I'll describe the process I go through below.
For the brave and impatient, you can skip the 'make test' step and run dh-make-perl with the --install option, and install it directly.
In addition, you can use the flag: --cpan MODULENAME and download the code from the CPAN directly. Combined with the --install option, this process is very automatic.
Hope this helps!
Update: Added paragraphs as to why you might want to do this, and a readmore.
-><- -><- -><- -><- -><- All things are Perfect To every last Flaw And bound in accord With Eris's Law - HBT; The Book of Advice, 1:7