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

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on how to update @INC at runtime to use custom modules in other folder?

Replies are listed 'Best First'.
Re: how to update @INC at runtime to use custom modules in other folder?
by davidrw (Prior) on Mar 25, 2006 at 21:36 UTC
    with respect to the struture you listed, where is the test script being run from?
    Just a
    use lib qw( tools/DBQuery );
    might do the trick. Note that 'use lib' takes a path, not a namespace as an argument ...
      And ditto with tools/ToolLog.

      The OP could use a rel2abs call in case he changes his directory later:

      use File::Spec::Functions qw(rel2abs); use lib rel2abs(tools/DBQuery), rel2abs(tools/ToolLog);

      Still, I'm wonderin, with such an elaborate directory structure, why the module name/namespace hasn't been extended to include the extra top level?

      use File::Spec::Functions qw(rel2abs); use lib rel2abs('tools'); use DBQuery::Data::BackendMap; use ToolLog::Logging;
Re: how to update @INC at runtime to use custom modules in other folder?
by saintmike (Vicar) on Mar 25, 2006 at 23:18 UTC
    You have already asked this question and received an answer.

    Why are you asking it again? And why is the new question again unclear, full of typos and riddled with bad formatting? Are you too busy to proof read your submissions?

Re: how to update @INC at runtime to use custom modules in other folder?
by ahmad (Hermit) on Mar 26, 2006 at 21:33 UTC

    as pointed above all should work fine for you

    plus you can try this way , just add this line in the TOP of your script

    BEGIN { push(@INC,'c:\tools'); }

    HTH