requires_external_bin: Adding dependencies on non-Perl stuff

Alias on 2006-02-12T12:09:53

The CPAN package count continues to edge towards 10,000, and at the same time plans continue for building the 6PAN.

Between the two problems it means when looking ahead we need to be thinking of ways to deal with package loading and dependencies across multiple languages and that can scale up to 100,000 packages.

We already have the Alien series of modules, which provides one possible solution. But it's more of a "do it" solution, and would require writing a new Perl package for every non-Perl package.

From what I can tell it's the solution you want when you really really need something installed, and you don't want to have to trust and wait for the OS people to package it up for you.

One alternative is to take a declarative approach to the problem.

The idea would be to provide a minimal amount of declarative information that will let your Makefile.PL check for support, and at the same time add it to a metadata file so that things like the debian/etc auto-packagers have enough information to fully automate their package creation. You say what you want now, and as support gets implemented and improved, you don't have to do anything else.

To kick things off I've just uploaded Module::Install 0.56 to CPAN.

It includes early experimental support for integrating Perl with other things at a package level.

As a start, I've added a requires_external_bin command (documented on the main page).

If your module uses a system command (for example, the 'cvs' client) you can add the following command to your Makefile.PL. requires_external_bin 'cvs'; Because there is no community concensus (yet) on how to represent the metadata of external dependencies, for now it just does a check to make sure it can find the relevant command in the PATH.

But if you add the command now, down the track when external metadata support is added, your next version will use it, and it should then be much easier to both get debian/redhat/whatever packages of your modules and keep them up to date.

I expect more commands, such as requires_external_lib (or similar) to start appearing as more people that understand the specific needs of different types of dependencies get involved.


neat - very useful indeed

TeeJay on 2006-02-12T16:28:11

I'll find this helpful is several projects - both commercial and f/oss (and both, as they not exclusive).

The only stuff I'd ask for would be if a file exists - i.e. /proc/cpuinfo or something for some of the linux dependant stuff we have, and of course, libraries existing which you've already pointed out.

good work, if time allows I'll look at checking a dir or file exists.