Subject: | Install of modules fail with CPAN.pm if Module::Build not installed |
Not sure whether this is a bug or a feature. In any case, if you try to install a module that uses Module::Build for its build process _and_ Module::Build is not installed, installation of the module will fail with the message that Module::Build can not be loaded.
Which initially makes you wonder why the module author was stupid enough to not list that dependency. Until you find out everything is hunky dory when Module::Build _is_ installed.
Being a module author myself, I like the concept of Module::Build a lot, especially the "recommended" functionality. However, I'm very hesitant to
start using Module::Build if it is going to fail in all those cases where
Module::Build is not installed yet.
I tried to adapt the Makefile.PL that apparently comes with Module::Build such:
eval "use Module::Build::Compat";
if (!defined %Module::Build::Compat::) {
warn "*** Attempting to install Module::Build first\n";
eval "use CPAN";
if (defined $CPAN::VERSION) {
if (my $cpan = CPAN::Shell->expand( 'Module','Module::Build' )) {
$cpan->install;
eval "use Module::Build::Compat";
}
}
}
if (defined %Module::Build::Compat::) {
Module::Build::Compat->run_build_pl(args => \@ARGV);
Module::Build::Compat->write_makefile();
} else {
warn <<EOD;
This module can only be installed if the Module::Build package
has been installed. Please install Module::Build _first_ before
attempting to install this module again.
EOD
exit 1;
}
anyway, you get the idea.