Re: [Module::Build] Document install_base_relpaths
Status: Beta
Brought to you by:
kwilliams
|
From: Randy W. S. <ml...@th...> - 2006-04-06 10:55:51
|
David Wheeler wrote: > On Mar 6, 2006, at 17:51, Randy W. Sims wrote: >> Maybe we can change them to accept a new value, and then document >> them. that would be a simple and effective interim solution: >> >> $self->install_base_relpath(); # deprecated; returns reference to >> internal data >> $self->install_base_relpath($elem); # returns path for $elem >> $self->install_base_relpath($elem => $new_val); # sets path for $elem > > Sure. I know we're trying to push 0.28 out, but the whole issue of supporting custom install types is nagging at me. I've documented and beefed up the interface for install_base_relpaths(), prefix_relpaths(), and install_path(). And improved the install_types() method to recognize elements added from the afore mentioned methods. Example below. David, could you let me know if this provides a solid interim solution to the issues you've brought up. The repository has now moved to a subversion repository at <https://svn.perl.org/modules/Module-Build/> if you want to check it out. Thanks, Randy. use Module::Build; my $build_class = Module::Build->subclass(code => <<'---'); sub new { my $package = shift; my $self = $package->SUPER::new(@_); $self->add_build_element('config'); $self->install_base_relpaths(config => 'etc'); $self->prefix_relpaths($self->installdirs, config => 'etc'); return $self; } sub find_config_files { my $self = shift; return { 'etc/sample.conf' => 'config/Foo.conf' }; } sub _warn_if_no_config { my $self = shift; $self->log_warn( "Config files will not be installed.\n" ) unless $self->install_base() || $self->prefix() || $self->install_path('config'); } sub ACTION_install { my $self = shift; $self->_warn_if_no_config(); $self->SUPER::ACTION_install(@_); } sub ACTION_fakeinstall { my $self = shift; $self->_warn_if_no_config(); $self->SUPER::ACTION_fakeinstall(@_); } --- my $builder = $build_class->new( module_name => 'Foo', license => 'perl', ); $builder->create_build_script(); |