Skip Menu |

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 14913
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: william [...] knowmad.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.2611
Fixed in: (no value)



Subject: Using add_build_element to install custom files
Hi Ken, I was following the Cookbook example that shows the usage of add_build_element to copy extra files when building and installing a module. When I use it as shown in the example of copying files not in the lib/ directory, it will create a new subdirectory for me. However, the `Build install` process will not follow-through and copy these news files to the install_base path. Other than setting install_path, I see no way to get these addt'l, non-standard directories to be copied. Unfortunately, install_path requires an absolute path which does not support dynamic build and install. Is there anything I'm doing wrong in my configuration (see snippet below) which would cause these extra directories not to be copied? From what I could follow of the code, in order for a directory to get installed, it needs to be in the hash returned by install_types(). Is there some way I can get install_path to be relative to install_base? my $build = MyBuilder->new ( ... snip ... extra_files => { 't/conf/test.setup.dat' => 'example/test.setup.dat', 't/htdocs/mailform.cgi' => 'example/mailform.cgi', } ); $build->add_build_element('extra'); $build->create_build_script; BTW, a note in the Cookbook that indicates that it is not possible to copy files to a custom directory would be helpful to others who are learning how the build system works. I was expecting all the files that got copied into blib/ to be installed when I ran `./Build install`. Thanks, William
If you want to add something to the install_base relative paths, you can actually do it in your Build.PL like so: $build = Module::Build->new(...); $build->install_base_relpaths->{example} = ['foo', 'bar']; $build->install_sets->{$build->installdirs} = '/foo/bar'; ... $build->create_build_script; The first call sets up the path relative to the install_base, the second gives the (absolute) path for a "normal" install (and has the side effect of adding "example" to install_types), assuming the user doesn't change installdirs during "Build install". If you really want to cover your bases on that last one, you'd have to specify thhe path for all three installdirs. Not a very nice interface, certainly - but it will continue to work in future versions of Module:: Build. We'll have to come up with some better interfaces for this kind of stuff in the future. -Ken