I am building a module disribution, but a test in t/ that tries use_ok can't find the modules in lib/. I am wondering how to make that test work.

I used Module::Starter to get my collection of modules off the ground. This is where I get the "module distribution" I'm talking about -- it's a directory with my modules inside lib/, some tests in t/, a Makefile.PL, Changes, README, MANIFEST and bin/.

While I've done plenty of modules in the past, this is the first time I've done any automated tests. That's a confession. I *have* read Test::Tutorial and the docs for Test::More and Test::Simple, FWIW.

The sole test created by Module::Starter is one that calls use_ok against each module in my distribution. When I run this test by typing perl -wT 00_load.t, each test fails with "Can't locate My/Module/Path/Here.pm in @INC" etc.

I have the whole lib/ directory of my module distribution softlinked into the directory specified in my PERL5LIB environmental variable. Not sure why this doesn't work

Since I'm new to testing I'm wondering if I'm going about this all wrong. How am I *supposed* to run my tests? Am I supposed to just copy the whole module distribution into /tmp (or checkout via svn) and then do perl Makefile.PL && make test? Am I supposed to do what I'm doing -- just perl -wT ##-name.t each file inside t/??

Very lost. Thanks for any help.


In reply to Test::More::use_ok can't find the module by ryantate

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.