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

Greetings Monks,

I guess this is more of a CentOS/distribution question, but here goes anyway:

I'd like to set PERL5LIB universally for all users (including root) on CentOS. I've tried the following in /etc/profile.d/abc.sh

export PERL5LIB="/abc"

But it's not being used at all/by any scripts. I've even tried using /etc/profile.d/perl.sh without success.

I'd appreciate any pointers

Thanks

RESOLVED: /etc/profile.d/* scripts are only run when a user LOGS IN, not merely opening terminals when already logged in.

Replies are listed 'Best First'.
Re: PERL5LIB on CentOS
by Corion (Patriarch) on Jun 27, 2014 at 12:54 UTC

    For example cronjobs do not load the .profile for the user.

    Maybe you want to tell us more details about which scripts work and which don't, and what the difference between them is?

      ok, thanks - looks like the only way to do this with cron is explicitly:

      */5 * * * * export PERL5LIB=/abc /xxx/script.pl

      That solves that problem.

      However, NO scripts for any users use PERL5LIB from /etc/profile.d/xxxx.sh

        Simple diagnosis. Login as the user in question then try this:

        $ echo $PERL5LIB /foo/bar/lib $ perl -e 'print $ENV{PERL5LIB} . "\n";' /foo/bar/lib

        which will show whether it is in the environment to begin with and if so whether you are doing something in your perl setup to negate that.

Re: PERL5LIB on CentOS
by 1s44c (Scribe) on Jun 28, 2014 at 17:11 UTC

    The intermediate perl book recommends not setting PERL5LIB system wide for all users. Users who have discovered CPAN will mess around with that variable.

    The book recommends adjusting the source and recompiling instead, which does sound like a load of pain to me.

    Why not just put your modules in /usr/local/lib/site_perl? That should be in @INC.

    EDIT: just checked, it's /usr/local/lib/perl5 on CentOS.