So I've made a few modules for my own use, and I'm wondering if there is any documentation about how to write tests for perl modules using Module::Build.
The specific problem I'm running into is that I've got three modules, HomeBrew::IO, HomeBrew::Stats, and HomeBrew::Bio, and I can't figure out how to build or test them separately the way the files are arranged.
The three module files are located in the same directory .../HomeBrew/lib/HomeBrew/, and I've got three Build.PL files located in the .../HomeBrew/ directory (named IO-Build.PL, etc), and three .t files in .../HomeBrew/t/ (named HomeBrew-IO.t etc).
What seems to happen is that the three Build.PL files don't seem to know that they're only supposed to build one module at a time. I'll show you one of these:
#!/usr/bin/perl
use warnings;
use strict;
use Module::Build;
my $build = Module::Build->new
(
module_name => "HomeBrew::IO",
dist_author => "George Locke",
dist_abstract => "Various utilities for reading files",
build_requires => {
'Test::More' => '0.10',
'POSIX' => '0', # for tmpname()
'Test::Exception' => '0', # to test that checkExist dies
},
);
$build->create_build_script();
(I should probably be using File::Temp instead of POSIX, but this is only used in testing so it's not a high priority)
In the future, I would like to change my test scripts to have one for each subroutine so I can say Build test checkExist and check just one at sub at a time.
So,
how do I make sure that create_build_script() doesn't include every single .pm file in the
lib/HomeBrew. I'd prefer to keep all the HomeBrew module files within the.../HomeBrewdirectory, but do I have to separate out each one into different directories?How do I make tests for each subroutine such that Module::Build knows how to test a whole module or just one part of it?
right now, when I say ./Build test it tests all three modules at once (and ./Build install installs all three at once).