[Module::Build] add_property()
Status: Beta
Brought to you by:
kwilliams
|
From: Peter S. <Pe...@PS...> - 2006-02-14 00:10:56
|
I'm wondering why the add_property() method isn't exposed to the
user? It seems that it would be handy for my case; I have a config.yml
file that I want installed in the etc/ directory off my target, and I'm
hardwiring the install_base here because this is something that gets
used at a client site. I started with:
my $builder = Module::Build->new
(
install_base => '/path/to/install',
script_files => [ 'dummy' ],
yml_files => { 'config.yml' =>
'/path/to/install/etc/dummy.yml' },
dist_name => 'dummy',
dist_version_from => 'dummy',
);
$builder->add_build_element('yml');
$builder->create_build_script;
However, I don't like having to repeat /path/to/install in there. To
remove the duplication I ended up doing:
my $builder = Module::Build->new
(
install_base => '/path/to/install',
script_files => [ 'dummy' ],
dist_name => 'dummy',
dist_version_from => 'dummy',
);
sub Module::Build::find_yml_files {
my $self = shift;
return { map $self->localize_file_path($_),
'config.yml' => $self->install_base . '/etc/dummy.yml'
};
}
$builder->add_build_element('yml');
$builder->create_build_script;
But it seems that if I had been able to call add_property, it would
have been simpler:
my $builder = Module::Build->new
(
install_base => '/path/to/install',
script_files => [ 'dummy' ],
dist_name => 'dummy',
dist_version_from => 'dummy',
);
$builder->add_property('yml_files'); # Method not found
$builder->yml_files({ 'config.yml' => $self->install_base .
'/etc/dummy.yml' });
$builder->add_build_element('yml');
$builder->create_build_script;
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/
http://www.perlmedic.com/
|