[Module-build-general] CPANPLUS support for Module::Build
Status: Beta
Brought to you by:
kwilliams
From: Dave R. <au...@ur...> - 2003-01-05 00:05:23
|
I was happy to see this in the latest release, but out of curiosity I started digging into the implementation code, and I found some problems. In CPANPLUS::Internals::Make::_find_prereq_module_build, the code looks at the _build/prereqs and then _parses_ the file. This is not a good idea for several reasons. One, the file is perfectly good Perl code, and can be eval'd. But even more importantly, Module::Build supports a more complex version number specification system. For example: requires => {Foo::Module => '2.4', Bar::Module => 0, Ken::Module => '>= 1.2, != 1.5, < 2.0', perl => '5.6.0'}, Notice the third line, which says the version must be greater than or equal to 1.2, not 1.5, and less than 2.0. What CPANPLUS should do is _load_ Module::Build and then do something like this: my $build = resume Module::Build ( properties => { config_dir => '_build', build_script => 'Build', }, ); my $failures = $build->prereq_failures; $failures will contain a hashref that details exactly what failed (or it'll be empty if everything passed). This A) lets there be just one piece of code to check prereqs, and B) lets CPANPLUS take advantage of Module::Build's more sophisticated version specs (plus the ability to list conflicts, etc.) Another problem is that CPANPLUS might end up passing MakeMaker flags to Module::Build (like TEST_VERBOSE=1 instead of verbose=1). Ken, I'd suggest just having Module::Build look for at least a commonly used superset of the MM flags. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ |