Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Module::Build's pm_files in ExtUtils::MakeMaker?

by xdg (Monsignor)
on Sep 20, 2005 at 14:13 UTC ( #493458=note: print w/ replies, xml ) Need Help??


in reply to Module::Build's pm_files in ExtUtils::MakeMaker?

Look at the Module::Build::Cookbook on adding new file types to the build process. E.g. (from the cookbook)

Sometimes you might have extra types of files that you want to install alongside the standard types like .pm and .pod files. For instance, you might have a Foo.dat file containing some data related to the Boo::Baz module. Assuming the data doesn't need to be created on the fly, the best place for it to end up is probably as Boo/Baz/Foo.dat somewhere in perl's @INC path so Boo::Baz can access it easily at runtime. The following code from a sample Build.PL file demonstrates how to accomplish this:

use Module::Build; my $build = new Module::Build ( module_name => 'Boo::Baz', ... ); $build->add_build_element('dat'); $build->create_build_script;

This will find all .dat files in the lib/ directory, copy them to the blib/lib/ directory during the build action, and install them during the install action.

There's more in the cookbook about what to do if you don't want to leave the files under lib, but keep them somewhere else instead.

use Module::Build; my $build = new Module::Build ( module_name => 'Boo::Baz', dat_files => {'some/dir/Foo.dat' => 'lib/Boo/Baz/Foo.dat'}, ... ); $build->add_build_element('dat'); $build->create_build_script;

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.


Comment on Re: Module::Build's pm_files in ExtUtils::MakeMaker?
Select or Download Code
Re^2: Module::Build's pm_files in ExtUtils::MakeMaker?
by LTjake (Prior) on Sep 20, 2005 at 17:39 UTC

    Hi! Thanks for your reply.

    With your suggestion, i can now do the following which allows me to get rid of the pm_files section.

    my $build = Module::Build->new( # ... tmpl_files => { 'etc/photos_index.tmpl' => 'lib/CGI/Application/PhotoGallery/ +photos_index.tmpl', 'etc/photos_single.tmpl' => 'lib/CGI/Application/PhotoGallery +/photos_single.tmpl', } ); $build->add_build_element( 'tmpl' ); $build->create_build_script;

    So, Thanks! =)

    However, the auto-generated Makefile.PL still has no idea about those templates and will not install them as needed.

    --
    "Go up to the next female stranger you see and tell her that her "body is a wonderland."
    My hypothesis is that she’ll be too busy laughing at you to even bother slapping you.
    " (src)

      I'd bring it up on the Module::Build mailing list. It looks like it might not be too hard to patch Module::Build::Compat to write a PMLIBDIRS argument to the Makefile.PL -- assuming that's the right way to do it... I don't know ExtUtils::MakeMaker well enough..

      -xdg

      Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      Just in case anyone stumbles across this older post ... it's possible that the issue has been fixed, but there's (currently) nothing to stop you from using a different build element whose files are also in lib, where MakeMaker would find them:

      tmpl_files => { map { $_ => $_ } glob( 'lib/CGI/Application/PhotoGallery/*.tmpl' +) },

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://493458]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2014-08-31 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls