<?xml version="1.0" encoding="windows-1252"?>
<node id="133273" title="Leveraging Debian for Module Management" created="2001-12-19 20:39:04" updated="2005-08-13 11:32:47">
<type id="120">
perlmeditation</type>
<author id="70219">
jwest</author>
<data>
<keywords>
<keyword rating="">
debian</keyword>
<keyword rating="">
perl</keyword>
</keywords>
<field name="doctext">
For those of you who run [http://www.debian.org|Debian GNU/Linux], a relatively obscure package could make your life a lot easier.&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
&lt;readmore&gt;
&lt;br&gt;
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 &lt;em&gt;management&lt;/em&gt;.&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
&lt;ul&gt;
  &lt;li&gt;Pull down the source for the CPAN module you want to build&lt;/li&gt;
  &lt;li&gt;gunzip the download, and untar it as per normal&lt;/li&gt;
  &lt;li&gt;cd into the base of the source.  Instead of running 'perl Makefile.PL', run: &lt;code&gt;dh-make-perl --build&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;When the .deb is generated, run 'make test', as you normally would&lt;/li&gt;
  &lt;li&gt;If all is successful, install the newly generated .deb&lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
In addition, you can use the flag: &lt;code&gt;--cpan MODULENAME&lt;/code&gt; and download the code from the CPAN directly.  Combined with the --install option, this process is very automatic.&lt;br&gt;
&lt;br&gt;
Hope this helps!&lt;br&gt;
&lt;br&gt;
--[jwest]&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;Update&lt;/strong&gt;: Added paragraphs as to why you might want to do this, and a readmore.&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;
-&gt;&lt;- -&gt;&lt;- -&gt;&lt;- -&gt;&lt;- -&gt;&lt;-
All things are Perfect
    To every last Flaw
    And bound in accord
         With Eris's Law
 - HBT; The Book of Advice, 1:7
&lt;/pre&gt;</field>
</data>
</node>
