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

I have some common modules that are used in several places so I have created a directory for them at /usr/lib/perl_modules. I want to include this location in @INC for every user, including CRON.

I've added export PERL5LIB=/usr/lib/perl_modules in both /etc/environment and /etc/profile.

When I list the environment variables, PERL5LIB is there as expected. But when I try to use on of the modules I get an error:

Can't locate in @INC (you may need to install the my_modu +le module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/ +perl/5.36.0 /usr/local/share/perl/5.36.0)
There are other locations in @INC but /usr/lib/perl_modules is not one of them...

I suspect the environment variable is set for root that I'm using to list the variables, but not for whatever process is running the script within Apache.

How can I properly set PERL5LIB for all users and processes or is there a better way to get an extra entry in @INC for every script without having to use lib in every script?