views:

93

answers:

1

If I have a distribution with X and X::Y also in it, how do I make Module::Build install both the modules? I have put X.pm in lib, written a file Build.PL with the line

my $build = Module::Build->new
    (
     module_name => "X",
 );

This installs X OK, but how do I tell Module::Build to also include X::Y in the distribution?

+3  A: 

Module::Build should automatically find and install both modules, though you should indicate to it (in Build.PL) which one the distribution name/version is taken from.

Try creating your distribution with module-starter and let it worry about the details?

module-starter -mb --module=X --module=X::Y --author=Me [email protected]
ysth
Thanks. My directory structure was faulty (`X::Y` was not in `lib`).
Kinopiko
That MakeMaker lets you stick Foo.pm and Bar/Baz.pm at the top level directory rather than in lib/ is a historical artifact which Module::Build joyously ditched.
Schwern
Thanks for your comment, but that's not the reason for my problem. I put `X.pm` in `lib` as expected, wrote a file for Module::Build with `module_name => "X"`, and then I started trying to find how to tell Module::Build to also include `X::Y`. I didn't realise it would be found and installed automatically if I put it into `lib` until I read ysth's answer.
Kinopiko