Search code examples
perlcpantcsh

ActivePerl CPAN and .tshrc


I installed ActivePerl (5.24.3.1) on a Mac OS X and caused 'havoc' with CPAN installations. The new installs are separated from the "core CPAN.pms", in "sites/lib/".

Anyway I have stuck the following in my directory .cshrc

setenv PERL5LIB PERL5LIB:/usr/local/ActivePerl-5.24/lib:/usr/local/ActivePerl-5.24/site/lib

I made it up, but everything seems to work. Is it valid code?


Solution

  • That line correctly appends to the environment variable PERL5LIB in tcsh.

    From man tcsh on my system

    setenv [name [value]]

    Without arguments, prints the names and values of all environment variables. Given name, sets the environment variable name to value or, without value, to the null string.

    An environment variable in tcsh can be set to a value that represents a list by separating entries with a colon (:). Thus saying PERL5LIB:... is a way to append to an existing value of PERL5LIB.

    The PERL5LIB, as explained in perlrun, is

    A list of directories in which to look for Perl library files before looking in the standard library and the current directory. Any architecture-specific and version-specific directories, such as version/archname/, version/, or archname/ under the specified locations are automatically included if they exist, with this lookup done at interpreter startup time.

    but note that the "current directory" is not searched for libraries any more, a security enhancement in modern Perl versions.

    So your line is adding the /usr/local/ActivePerl locations to the defaults paths set up in your Perl version.

    I can't tell how and why ActivePerl "caused havoc with CPAN installations" (?) on a Mac OS X. I presume that you had another Perl installed (by your mention of "CPAN installantions"), but I am confused as to which one you are using now, once that ActiveState is there (as well?).