Making Linux Server Directories More Readable, Add to Perl's @INC Array
February 22, 2010
You're most likely to have encountered the Perl @INC array in the context of a "cannot find module" error. This is the list of directories Perl searches when looking for a module. To see a list of what's in @INC, try this one-liner:
Note that it includes ., the current working directory. In some cases, it also includes /etc/perl, which can be a good location for user-written modules.
If you're using CPAN as root, or installing modules as packages from your distribution, everything will wind up in the Right Place automatically. If you have root access, you can also add your own modules by hand. However, it's not actually possible to change @INC permanently without recompiling, and you will always have root access.
Here are a handful of other ways to make Perl find a module that's installed in a non-standard location.
Of course, because this is Perl, there are other ways to do it. Feel free to experiment!
Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of "Linux System Administration Recipes: A Problem-Solution Approach" (Apress, 2009).