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

hello all
I have my folders structures like below
C:.
----etc
-------usr
----------bin
--------------7zip
--------------GI
--------------WGET
----------lib
--------------local
-------------------cq1
-------------------cq2
-------------------cq3
-------var
----------local
--------------cq1
-----------------Export
------------------------Aborted
------------------------Processed
-----------------Import
------------------------AbortedCSVFiles
------------------------ProcessedCSVFiles
--------------cq2
--------------cq3
-------logs
-----------cq1
-----------cq2
-----------cq3
-------tmp

I have my common Perl modules (which are class files basically) in the folder \usr\lib. My main scripts which calls these call modules are in \usr\local\cq1 or cq2 or cq3

Can any one tell me how i could include the perl modules from lib colder in cq1 folder?

I am using windows XP BTW
Thanks in advance
  • Comment on How to call my own perl module from a folder

Replies are listed 'Best First'.
Re: How to call my own perl module from a folder
by cdarke (Prior) on Aug 05, 2008 at 10:48 UTC
    There are several alternatives. You could set the directory name to environment variable PERL5LIB.

    Or you could:
    use lib '\etc\usr\lib';
    If I understood your tree correctly. It is best to use the full path name, in case scripts are moved.
    If you don't like hard-coding a path, and you don't like PERL5LIB then you can use your own environment variable:
    use lib $ENV{MY_PERL_LIB};
    Alternatively you can manipulate @INC directly in a BEGIN block, but you probably want to avoid that unless you have a good reason.
      Thanks guys
      I dont want to do a make its just a plain perl module in different folder.
      i will try this possibilities..thanks a lot
Re: How to call my own perl module from a folder
by Bloodnok (Vicar) on Aug 05, 2008 at 09:59 UTC
    Hi ,

    The usual means of modules installation i.e. dmake test install, will assume the target directory to be the site/lib directory of the perl installation directory - this can be modified using the PREFIX macro when running perl Makefile.PL - see Re: best way to install modules in your home directory?.

    HTH,

    At last, a user level that overstates my experience :-))
Re: How to call my own perl module from a folder
by MidLifeXis (Monsignor) on Aug 05, 2008 at 10:48 UTC