in reply to Require all modules in lib ?

I don't know what's happening, but it is always wise to check $@ after an eval; that may give you some idea of what's going on. Alternatively you can do something like this:

eval "require $val; 1" or die $@;
or even just this
eval "require $val" or die $@;
since the require should return true (the first form is arguably clearer, though).

the lowliest monk

Replies are listed 'Best First'.
Re^2: Require all modules in lib ?
by ZlR (Chaplain) on Jun 07, 2005 at 12:07 UTC
    Hello tlm,

    It doesn't raise any other warning .

      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.

      the lowliest monk

        Hey tlm you're right !

        It's indeed a path problem, and if all the scripts are in the same directory it works fine. So since my scripts are in different directories i used Cwd and chdir'ed to the correct lib directory before doing the require. Since the caller script is in another directory it works ok this way .

        Thanks a lot !