Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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!


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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2023-12-09 01:41 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (37 votes). Check out past polls.