edwardt_tril has asked for the wisdom of the Perl Monks concerning the following question:

Hi I have directory structure that contains some modules and I want (first timer) to use the test modules to test those
module. But it keeps saying tht it can't find my modules. I do not want to change the include path permantly
or supply throught he command line (I need to package this to an exe) and with other tools that have different
@INC requirements. So I am thinking to let the script to add the directory do
the tests then restore to what it was.
Here is my dir structure (all windows):
tools\DBQuery\Config
tools\DBQuery\Connection
tools\DBQuery\Data
tools\ToolLog
test folders:
tools\DBQuery\test\TstBackEndMap
tools\DBQuery\test\TstConection
tools\DBQuery\test\TstReporterSQLMap
But there is a problem in use lib line... e,g, for a file in TstBackEndMap , i try to tell to also use
the path from DBQuery to look for BackendMap but it can't so I am trying to arrange the associated packages into folders for neatness.
but because this app will be plug into other framework, I do not want o disturb the environment variables or the @INC in global scale.
so for example:
Here is my dir structure (all windows):
tools\DBQuery\Data\BackendMap.pm
tools\ToolLog\Logging.pm
test folders:
tools\DBQuery\test\TstBackEndMap\testbackendmap.t
so testbackendmap.t need to use Data::BackendMap but it cannot find it event I tried to use use lib qw(Data::BackendMap);
how can I resolve this? thanks
A side note: In the future the tests may add BenchMark, Test coverage etc
use strict; use Test::More tests=>3; use lib qw(../../); use Data::BackendMap;

Replies are listed 'Best First'.
Re: finding the library from test
by saintmike (Vicar) on Mar 24, 2006 at 19:39 UTC
    Use several use lib lines or a colon-separated (semicolon on Win32) list for the PERL5LIB environment variable.
      Hi Sorry, I do not get what you mean. I am using use lib already and have changed to use ; as follows:
      use lib qw(.;../..);
      but I still gets Can't locate Data\BackendMap. Can you eloborate?
      Thanks.
        No, I was saying use
        use lib qw(path1); use lib qw(path2);
        or (!) set and environment variable before calling your script.