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

I have some perl modules.
I want not install it in system and use it directly from my program directory.
as example /program/lib/module/* is path to my modules.
my main program placed in /program.
How I can in main program set path to my modules?
This method can work in Perl for Linux and Strawberry Perl for Windows?

Replies are listed 'Best First'.
Re: Path to my modules
by toolic (Bishop) on Dec 14, 2010 at 20:47 UTC
      1.lib method will be work with Strawberry Perl? Now I can't test this, because I can't use Windows for 2 days. I will be far away from it.
      2.if I use this:
      use lib 'my/mymodulespath';
      then system @INC will be changed.
      I want use my modules without changing global system variables.
      This modules need only for my program!
      3. can I use some like next?
      use mymodules/mymodule;
        then system @INC will be changed.
        I want use my modules without changing global system variables.

        The @INC array isn't global to the system, but rather local to every Perl program. So, no worries. And yes, it works with Strawberry, too.

        use lib 'my/mymodulespath';

        A small tip, you might like to consider using absolute path names rather than relative. The path given will be relative to the current directory when the program is run, which is often not the same as the directory in which the script is stored. For example:
        use 'C:/program/lib/module';
Re: Path to my modules
by BrimBorium (Friar) on Dec 14, 2010 at 20:51 UTC
Re: Path to my modules
by eff_i_g (Curate) on Dec 15, 2010 at 04:37 UTC

      ... or rlib?

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)