OK, after all these years, I'm finally learning how to create a proper Perl module (yeah, I'm lame). I stumbled upon Module::Starter along with Damian Conway's plugin for it. These seem like great tools for helping me get up and running quickly and doing testing and making sure I document my code.

After installing these two modules, I can now issue a command like module-starter MyModule in my personal module library at ~/perl/perl-lib, (which I have in @INC) and it will set up all the files and the directory structures for testing and packaging my module. Sweet!

But when I go edit the module that was automatically generated for me at ~/perl/perl-lib/MyModule/lib/MyModule and run tests, I get an error:

t/00.load.t ....... 1/1 # Failed test 'use MyModule;' # at t/00.load.t line 4. # Tried to use 'MyModule'. # Error: Can't locate MyModule.pm in @INC (you may need to instal +l the MyModule module) (@INC contains: /home/steve/perl/perl-lib /etc +/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/pe +rl/5.20.2 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/ +lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/si +te_perl .) at t/00.load.t line 4. # BEGIN failed--compilation aborted at t/00.load.t line 4.
Now I know I'm getting this error because MyModule.pm is in the MyModule/lib directory. While I could simply add the full path to the test files, I'm assuming there's a better way to handle this. Can someone please clue me in? Thanks.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks


In reply to Running tests on modules generated by Module::Starter still in /lib directory by nysus

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.