Bootstrapping Makefile.PL with Apache::Bootstrap

Phred on 2009-04-28T05:03:23

Update - the Perlmonks node.

This is my latest attempt at a Makefile.PL section that invokes Apache::Bootstrap or exits with 255. The intent is that if Apache::Bootstrap is not installed, the Makefile.PL dies with exit code 255, the same failure code returned to the shell as if 'use 5.8.8;' failed in Makefile.PL. I've been looking around for a list where the MakeMaker experts hang out, please clue me in if you know of such a place.

#!/usr/bin/perl

use strict;
use warnings;

#########################################################################     
# minimum version of A::B required                                             
my $ab = 0.06;

eval { require Apache::Bootstrap };

($@ or ($Apache::Bootstrap::VERSION < $ab)) &&
    do { $! = 255; die("Apache::Bootstrap $ab required"); };

# make sure we have at least one minimum version of mod_perl                   

my $bs = eval { Apache::Bootstrap->new({    
                      mod_perl2 => 1.99022,
                      mod_perl  => 1.30 }) };

do { $! = 255; die($@); } if $@;

##########################################################################  

# use $bs to determine whether ExtUtils::MakeMaker or ModPerl::Build::MM should be used