In newer versions of CPAN.pm which support Module::Build, there appears to be a bug when dealing with a module that has a custom build module. I saw this trying to install HTML::Mason with the cpan shell.

The bug comes about because of the CPAN::Distribution::prereq_pm() method. It has the following code:

            if ($CPAN::META->has_inst("Module::Build")) {
                my $requires  = Module::Build->current->requires();
                my $brequires = Module::Build->current->build_requires();
                $req = { %$requires, %$brequires };
            }

Internally, when Module::Build->current() is called, it calls resume(). The resume() method will try to load the build_class. In the case of HTML::Mason, this is Mason::Build, which is shipped in the inc/ dir of the distribution.

Unfortunately, at this point the dir is not in @INC, so it blows up.

If I tell CPAN.pm to prefer the Makefile.PL, everything works (oh the irony) because the Makefile.PL ends up calling the Build script, which internally sets @INC to include inc/.

I'm not sure what the right fix is, but I suspect it belongs in Module::Build. It seems to me that if Module::Build is going to go through the trouble of checking to make sure it's got the right class instantiated for building, it ought to keep track of where to find that class.

This could be saved in _build/, I think, and then resume could check for something like _build/inc and get a list of directories to add before trying to load the proper build class.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

Reply via email to