How to place Perl modules in non-standard locations and use it
If this is the project structure, /home/directory/lib -- Libary2.pm /home/directory/project -- file1.pl -- file2.pl -- Libary1.pm In `file1.pl`, we can include both libraries by, use lib '/home/directory/project'; use lib '/home/directory/lib'; or So in `file1.pl`, #include both directory at once, use lib qw( /home/directory/project /home/directory/lib ); use Libary1; use Libary2; `file2.pl`,will have the same use lib qw( /home/directory/project /home/directory/lib ); use Libary1; use Libary2; The above code is good for 1 or 2 files. But if there are 10+ perl files, we have to include the same lib path in all files. If the library path changes, we had to change all files with the correct path name. So what I did was to have 1 module `config/LibPaths.pm` that will have the paths, and all files will include the module. lib -- Libary2.pm project -- file1.pl -- file2.pl -- Libary1.pm config -- LibPaths.pm ...