in reply to how do you build and test your modules locally before publishing
prove has the "-b" and "-I" switches, which can be used to specify where to find the library(s) that the tests need to use. For example, if MyMod::Foo hasn't been built yet, and just exists in a distribution tree such as:
MyMod-Foo/lib/MyMod/Foo.pm...and my tests are in...
MyMod-Foo/t/*.tThen I could 'cd' into MyMod-Foo, and execute the following:
prove -Ilib
This assumes the module doesn't require any special build process (for example, no XS, no Makefile.PL trickery). Or if my module has a Makefile.PM that conforms to the normal module building standards:
perl Makefile.PL make prove -b
...which first builds the module into a "blib" (build lib) directory, and then tells 'prove' to look in the MyModule-Foo/blib/ directory for the temporary built version of the module.
Perl also has the -I switch (that's -I as in Include -- <<corrected-thanks tobyink>> -- documented in perlrun. So once again, I could 'cd' into MyModule-Foo/ and type: perl -Ilib t/00-load.t, again assuming that the development version of the module resides in MyModule-Foo/lib/MyModule/Foo.pm.
If the module is standards conforming, you can use a version of the mantra: perl Makefile.PL, make, and make test, or perl Build.PL, Build, and Build test. Many authors also use environment variables to control what tests run. Additional information on distribution maintenance commands can be found in ExtUtils::MakeMaker
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how do you build and test your modules locally before publishing
by tobyink (Canon) on Dec 31, 2012 at 11:40 UTC | |
by davido (Cardinal) on Dec 31, 2012 at 17:21 UTC | |
|
Re^2: how do you build and test your modules locally before publishing
by gideondsouza (Pilgrim) on Dec 31, 2012 at 03:57 UTC | |
by tobyink (Canon) on Dec 31, 2012 at 11:35 UTC | |
by davido (Cardinal) on Dec 31, 2012 at 04:01 UTC |