[Module::Build] Extending M::B::Platform::* and issues with "provides"
Status: Beta
Brought to you by:
kwilliams
|
From: Chris D. <ch...@cl...> - 2003-10-07 17:58:55
|
I'm working on a subclass of Module::Build that is intended to package
non-Perl material. I've found M::B to be modular enough that this is
feasible without hacking *too* deeply (bravo to Ken and others!). One
aspect of this project includes adding platform-dependent compilation
routines. I accomplished this by simply saying something like:
-------- lib/Module/Build/Foo.pm -----------
package Module::Build::Foo;
our @ISA=qw(Module::Build);
...
sub ACTION_foo {
my $self = shift;
$self->compile_foo($_) for (@{ $self->find_foo_files })
}
...
package Module::Build::Base;
sub compile_foo {
print "Compiling foo is not supported on this platform\n';
}
package Module::Build::Platform::darwin;
sub compile_foo {
my ($self, $file) = @_;
$self->do_system("compileFoo", $file);
}
1;
---------------------------------------------
This seems to work great with one exception: META.yml now contains the
following lines
---------------------------------------
provides:
Module::Build::Base:
file: lib/Module/Build/Foo.pm
version: 0.10
Module::Build::Foo:
file: lib/Module/Build/Foo.pm
version: 0.10
Module::Build::Platform::darwin:
file: lib/Module/Build/Foo.pm
version: 0.10
---------------------------------------
I think this is bad thing, yes? I'm not providing those packages; I'm
just hacking them for my particular environment. Questions:
1) Is there a better way to add platform-specific extensions to M::B
subclasses without hacking ::Base and ::Platform::*?
2) Would explicitly declaring
sub Module::Build::Base::compile_foo { ... }
be better?
3) Is there a good way to tell ACTION_distmeta not to include those
hacked packages in the provides hash?
Thanks,
Chris
P.S. In M::B v0.20, ACTION_distmeta has an out-of-date warning message
about Module::Info. I happened to notice that in my research for the
above questions. I didn't check CVS to see if it's already been fixed.
--
Chris Dolan, Software Developer, Clotho Advanced Media Inc.
ch...@cl..., 294-7900, 211 S Paterson, Madison WI 53703
|