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/*.t

Then 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


In reply to Re: how do you build and test your modules locally before publishing by davido
in thread how do you build and test your modules locally before publishing by gideondsouza

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.