develooper Front page | perl.module-authors | Postings from November 2003

Re: How to indicate a dependency in my module

Thread Previous | Thread Next
From:
A. Pagaltzis
Date:
November 12, 2003 09:46
Subject:
Re: How to indicate a dependency in my module
Message ID:
20031112174555.GA9757@klangraum
* Bruno Negrao <qmail@engepel.com.br> [2003-11-10 20:11]:
> IŽm finishing to write a module, Proc::Daemontools, and it
> requires that the daemontools package be installed on a machine
> for it to work.  Where must I indicate that this module have a
> dependency?

I can't believe noone understood what you were talking about and
went off to lala-land. :-/

> In my test script, I cause the test to fail if it cannot find a
> process, 'svscan', running on the machine. Do you think that
> this can cause all the cpan-testers to fail?

Not a good approach for the reason you noted.

You seem to forget that Makefile.PL is a Perl script. :) I'd say
check for existence at the top of Makefile.PL and exit without
writing a Makefile and a status != 0 if you don't find it.

Make sure to provide a way for the user to supply a custom
location and inform them about it if your auto-find fails.
Something like

    warn <<"EOT"
    Can't find a daemontools installation on this system.
    This module is useless without that package. If you don't
    have it, see <http://foo/bar/>.

    If you have them installed in a nonstandard location, set the
    HAVE_DAEMONTOOLS environment variable to the correct
    directory and rerun this script, as in

        HAVE_DAEMONTOOLS=/opt/daemontools/ perl Makefile.PL

    EOT

If $ENV{HAVE_DAEMONTOOLS} is set, I'd skip the check on the
premise that the user knows what they're doing. It might be worth
thinking about whether you want to autoedit your Perl sources in
that case too. Someone who passed a wrong location will just have
their tests fail. Alternatively you could skip the check only if
$ENV{FORCE} is set or some such.

-- 
Regards,
Aristotle
 
"If you can't laugh at yourself, you don't take life seriously enough."

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About