Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Leveraging Debian for Module Management

by jwest (Friar)
on Dec 20, 2001 at 01:39 UTC ( #133273=perlmeditation: 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

Comment on Leveraging Debian for Module Management
Select or Download Code
Re: Leveraging Debian for Module Management
by Juerd (Abbot) on Dec 20, 2001 at 01:49 UTC
    One should surely put $(MAKE) test in both rules.xs and rules.noxs. They can be found in /usr/share/dh-make-perl/, but if you have them in ~/.dh-make-perl/, those will override the system wide files.

    It's a shame that I don't know anything about Makefiles, 'cause it would be nice if we could capture and handle output like:
    t/12_signals_ev.......skipped: the Event module is not installed
    or:
    Warning: prerequisite Array::RefElem failed to load: Can't locate Arra +y/RefElem....
    OTOH, they're probably handled by dh-make-perl, so it must be possible to grab it somehow. (Yes, dh-make-perl itself is a perl program (duh :))

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://133273]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-08-28 15:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (263 votes), past polls