Added a Module::Build::Compat 'passthrough' Makefile.PL
[dbsrgits/SQL-Translator.git] / Makefile.PL
1 # $Id$
2
3 use strict;
4
5 unless (eval "use Module::Build::Compat 0.02; 1" ) {
6   print "This module requires Module::Build to install itself.\n";
7   
8   require ExtUtils::MakeMaker;
9   my $yn = ExtUtils::MakeMaker::prompt
10     ('  Install Module::Build now from CPAN?', 'y');
11   
12   unless ($yn =~ /^y/i) {
13     die " *** Cannot install without Module::Build.  Exiting ...\n";
14   }
15   
16   require Cwd;
17   require File::Spec;
18   require CPAN;
19   
20   # Save this 'cause CPAN will chdir all over the place.
21   my $cwd = Cwd::cwd();
22   
23   CPAN::Shell->install('Module::Build::Compat');
24   CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
25     or die "Couldn't install Module::Build, giving up.\n";
26   
27   chdir $cwd or die "Cannot chdir() back to $cwd: $!";
28 }
29 eval "use Module::Build::Compat 0.02; 1" or die $@;
30
31 Module::Build::Compat->run_build_pl(args => \@ARGV);
32 require Module::Build;
33 Module::Build::Compat->write_makefile(build_class => 'Module::Build');