Re: [Module::Build] problem with programmatic control of multiple builds
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <ke...@ma...> - 2006-06-07 21:33:55
|
On Jun 5, 2006, at 1:15 PM, Ray Zimmerman wrote:
> Thanks for the suggestions Ken & Randy.
>
> On Jun 3, 2006, at 1:14 PM, Ken Williams wrote:
>> As a workaround, you could probably do "delete $INC{"Module/Build/
>> Base.pm"}; require Module::Build::Base;" each time through the loop.
>
> It turns out that I also need to do ...
>
> Symbol::delete_package('Module::Build::Base');
>
> ... every time through the loop as well in order to avoid tons of
> "subroutine foo redefined ..." warnings. This *appears* to work,
> however, the comments in the "BUGS" section of the docs for Symbol
> make me uncomfortable with using this approach.
If it's really just the build_elements structure that's causing
trouble, you could use the following chicanery:
my $orig_elements;
foreach my $dist ( @dist_list ) {
my $dir = File::Spec->join('my_build_dir', $dist);
chdir $dir or die "could not change to $dir";
$p = { <some build options> };
my $b = Module::Build->new_from_context( %$p );
if ($orig_elements) {
$b->build_elements($orig_elements);
} else {
$orig_elements = $b->build_elements;
}
$b->dispatch('build');
$b->dispatch('test');
$b->dispatch('install');
}
I suppose that if() business could all be abbreviated to
$b->build_elements($orig_elements ||= $b->build_elements);
-K
|