8.2. Module-Build commands
The first thing we should do is change the directory to the directory that Module-Starter created and run perl Build.PL
. We get some output like the following:
shlomi[homepage]:$p4n/5/src/module-build-and-starter$ cd MyMath-Ops/ shlomi[homepage]:$p4n/5/src/module-build-and-starter/MyMath-Ops$ perl Build.PL Checking whether your kit is complete... Looks good Checking prerequisites... Looks good Deleting Build Removed previous script 'Build' Creating new 'Build' script for 'MyMath-Ops' version '0.01' shlomi[homepage]:$p4n/5/src/module-build-and-starter/MyMath-Ops$
What the perl Build.PL
command does is generate the Build
script in the current directory that can be used to perform such operations as building, testing, packaging, and installing of the distribution. Sometimes we need to re-run perl Build.PL
if we modified the configuration.
Now let's run ./Build
and ./Build test
.
shlomi[homepage]:$p4n/5/src/module-build-and-starter/MyMath-Ops$ ./Build Copying lib/MyMath/Ops/Subtract.pm -> blib/lib/MyMath/Ops/Subtract.pm Copying lib/MyMath/Ops/Divide.pm -> blib/lib/MyMath/Ops/Divide.pm Copying lib/MyMath/Ops/Multiply.pm -> blib/lib/MyMath/Ops/Multiply.pm Copying lib/MyMath/Ops.pm -> blib/lib/MyMath/Ops.pm Copying lib/MyMath/Ops/Add.pm -> blib/lib/MyMath/Ops/Add.pm Manifying blib/lib/MyMath/Ops/Add.pm -> blib/libdoc/MyMath::Ops::Add.3pm Manifying blib/lib/MyMath/Ops/Multiply.pm -> blib/libdoc/MyMath::Ops::Multiply.3pm Manifying blib/lib/MyMath/Ops/Subtract.pm -> blib/libdoc/MyMath::Ops::Subtract.3pm Manifying blib/lib/MyMath/Ops/Divide.pm -> blib/libdoc/MyMath::Ops::Divide.3pm Manifying blib/lib/MyMath/Ops.pm -> blib/libdoc/MyMath::Ops.3pm shlomi[homepage]:$p4n/5/src/module-build-and-starter/MyMath-Ops$ ./Build test t/00-load.t ....... 1/5 # Testing MyMath::Ops 0.01, Perl 5.010001, /usr/bin/perl5.10.1 t/00-load.t ....... ok t/boilerplate.t ... ok t/pod-coverage.t .. ok t/pod.t ........... ok All tests successful. Files=4, Tests=22, 1 wallclock secs ( 0.10 usr 0.04 sys + 0.60 cusr 0.12 csys = 0.86 CPU) Result: PASS shlomi[homepage]:$p4n/5/src/module-build-and-starter/MyMath-Ops$
What happens is that ./Build
copies the files under blib/
, builds the documentation, and in case we had XS (= "External Subroutine" - perl routines written in a low-level language) it would also build the extensions. This allows us to run tests against the built code, either automated or manual by using the blib module.
After we had ran ./Build
, we ran ./Build test
to run the automated tests that Module-Starter generated for us. As you can see the line says that all tests successful. If they were not, we should fix either the code or the tests, depending on what is wrong.
Now let's move on.