Add Devel::CheckBin to your configure prereqs, and then at the top of
Makefile.PL:

use Devel::CheckBin;
check_bin('git');

Or, if you're using Dist::Zilla, just add this to dist.ini:
[CheckBin]
command = git


On Fri, Nov 11, 2016 at 3:22 PM, James E Keenan <jk...@verizon.net> wrote:

> My latest CPAN distribution (http://search.cpan.org/dist/D
> evel-Git-MultiBisect/) requires perl-5.10.0 and, as its name suggests,
> has an external dependency on git.  When a CPAN tester runs this distro on,
> say, perl-5.8.9, the run is characterized as 'NA' and the report (e.g.,
> http://www.cpantesters.org/cpan/report/dcf9bb82-a2b5-11e6-
> 886b-73ce95f05882) has this language:
>
> #####
> Output from '/usr/home/njh/perl5/perlbrew/perls/perl-5.8.9/bin/perl
> Makefile.PL':
>
> Perl v5.10.0 required--this is only v5.8.9, stopped at Makefile.PL line 1.
> BEGIN failed--compilation aborted at Makefile.PL line 1.
> #####
>
> This is fine.  But when the dependency on 'git' is not satisfied, the
> result is being reported as 'UNKNOWN' and the report (e.g.,
> http://www.cpantesters.org/cpan/report/4e8d6296-a2b9-11e6-
> 886b-73ce95f05882) has this language:
>
> #####
> Output from '/usr/home/njh/perl5/perlbrew/perls/perl-5.20.2/bin/perl5.20.2
> Makefile.PL':
>
> 'git --version' failed, suggesting absence of 'git'.
> No point in proceeding.
>  at Makefile.PL line 11.
> #####
>
> My Makefile.PL is currently coded like this:
>
> #####
> use v5.10.0;
>
> use ExtUtils::MakeMaker;
> use Carp;
>
> my $lack_git = <<MESSAGE;
> 'git --version' failed, suggesting absence of 'git'.
> No point in proceeding.
> MESSAGE
>
> system(qq|git --version|) and croak($lack_git);
> ...
> ####
>
> I would prefer that the absence of git result in an 'NA' rather than an
> 'UNKNOWN'.  How would I code my Makefile.PL to achieve that result?
>
> Thank you very much.
> Jim Keenan
>

Reply via email to