Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) 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.

  • Pull down the source for the CPAN module you want to build
  • gunzip the download, and untar it as per normal
  • cd into the base of the source. Instead of running 'perl Makefile.PL', run: dh-make-perl --build
  • When the .deb is generated, run 'make test', as you normally would
  • If all is successful, install the newly generated .deb

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!

--jwest

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

In reply to Leveraging Debian for Module Management by jwest

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (14)
    As of 2014-10-21 09:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (99 votes), past polls