ExtUtils::MakeMaker: how do I specify a binary executable prerequisite for test and/or installation?

Viewed 88

I am using ExtUtils::MakeMaker to create a Makefile for a Perl package from a Makefile.PL.

The Perl package (and the tests) are dependent on an executable that the Perl package calls via Perl's system().

Is there any way that I can specify the executable as a prerequisite with ExtUtils::MakeMaker.

1 Answers

Just add this line anywhere in Makefile.PL:

system("$executable", "--version") == 0 or die "$executable: $?";

You may want to search $executable also in other locations than $PATH and maybe want better diagnostics on errors but this is essentially what you should do. For libintl-perl I even compile and link C code inside Makefile.PL.

Unfortunately, you cannot easily port that technique to Module::Build and for the same reason you cannot use it with Dist::Zilla or similar build tools.

Related