I tried to reproduce your set-up from your description, and it works like a charm for me, so unless there is some difference between Windows and Unix that is relevant to this problem, or your code is significantly different from mine, I have no clue what could be the cause of the errors you're having. I include all the code below; maybe by comparing it with yours you will to figure out where the problem is. In my case, all the files live in /tmp/test/testlib.

#! perl # run.pl use lib '/tmp/test'; use testlib::testlib; Test::test(); __END__ # testlib.pm package Test; { use Cwd (); my $cur_dir = Cwd::cwd; chdir '/tmp/test/testlib' or die "chdir failed: $!"; for ( <*.pm> ) { next if $_ eq 'testlib.pm'; s/\.pm$//; warn "require'ing $_"; eval "require testlib\:\:$_" or die @$; } chdir $cur_dir or die "chdir failed: $!"; } sub test { Test::test1(); Test::test2(); } __END__ # mod1.pm package Test; 1; sub test1 { print 'test1 called', $/; } __END__ # mod2.pm package Test; 1; sub test2 { print 'test2 called', $/; } __END__

the lowliest monk


In reply to Re^3: Require all modules in lib ? by tlm
in thread Require all modules in lib ? by ZlR

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.