in reply to Re^2: Require all modules in lib ?
in thread Require all modules in lib ?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Require all modules in lib ?
by ZlR (Chaplain) on Jun 07, 2005 at 13:17 UTC |