On 4/13/07, carol white <[EMAIL PROTECTED]> wrote:

I want to use 2 modules in my perl program: module1.pm and module2.pm.
module1.pm is in current directory. to use module2.pm which is in another
directory I wil use: use lib 'path-to-other-directory';
but I have another module named module1.pm in the same directory as
module2.pm that I don't want to use. how could I avoid to use module1.pm
in the other directory?

The easiest way may be to put the 'use' directives in order:

 use module1;  # in current directory
 use lib 'path-to-other-directory';  # changes @INC
 use module2;  # in other directory

Then again, the easiest way may be to organize your modules properly.
Maybe you should put module2 into a directory that doesn't have any
modules you don't want, or maybe you should upgrade or remove module1.

You could also use a BEGIN block to put the new search paths at the
end of @INC instead of the start, or you could add another 'use lib'
to ensure that '.' is among the first directories searched. But I have
to say I'm partial to organizing modules according to your needs, in
the end.

Cheers!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to