Re: [Module::Build] Document install_base_relpaths
Status: Beta
Brought to you by:
kwilliams
|
From: David W. <da...@ki...> - 2006-03-04 17:31:20
|
On Mar 4, 2006, at 09:11, Ken Williams wrote:
> In general, with custom stuff in a distro, you first specify how it
> gets mapped to blib/, then how it gets mapped to installation
> directories.
Yes, but I think that a reasonable default would be "copy all of the
files from the distribution directory named for the element to the
same named directory under the install base." That's what I'm running
into when, for example, I want to install Mason components. They
don't need to be processed at all, just copied from comp to blib/comp
during ./Build, and from blib/comp to install_base/comp during ./
Build install.
That's why I was suggesting a separate method, so that it could be
independent. But ultimately what's happening for me is that I want to
make sure that the contents of the comp directory are installed in
comp relative to the install base, even if it should change during
the build process.
So I'm thinking something like this:
sub add_build_dir {
my ($self, $dir) = @_;
die "What the?" unless -d $dir;
$self->add_build_element($dir);
$self->install_base_relpaths->{$elem} ||= [$elem];
no strict 'refs';
*{ref $self . "::process_$dir\_files"} = sub {
my self = shift;
my $files = $self->find_files_in_dir($dir);
while (my ($file, $dest) = each %$files) {
$self->copy_if_modified(
from => $file,
to => File::Spec->catfile($self->blib, $dest)
);
}
};
}
Only perhaps less magical. Do you see what I'm getting at?
Best,
David
|