cherio has asked for the wisdom of the Perl Monks concerning the following question:
When I run strace (I've seen discussions that start this way but no answer to my question that follows) on my script it performs a lot of "stat" lookups before it succeeds to find the right modules. A sample sequence of "stat" tried file candidates for use Time::HiRes is below with the last one being valid.
/etc/perl/Time/HiRes.pmc /etc/perl/Time/HiRes.pm /usr/local/lib/x86_64-linux-gnu/perl/5.30.0/Time/HiRes.pmc /usr/local/lib/x86_64-linux-gnu/perl/5.30.0/Time/HiRes.pm /usr/local/share/perl/5.30.0/Time/HiRes.pmc /usr/local/share/perl/5.30.0/Time/HiRes.pm /usr/lib/x86_64-linux-gnu/perl5/5.30/Time/HiRes.pmc /usr/lib/x86_64-linux-gnu/perl5/5.30/Time/HiRes.pm /usr/share/perl5/Time/HiRes.pmc /usr/share/perl5/Time/HiRes.pm /usr/lib/x86_64-linux-gnu/perl/5.30/Time/HiRes.pmc /usr/lib/x86_64-linux-gnu/perl/5.30/Time/HiRes.pm
We use a lot of real time perl scripting in an envoronment with high IOPS. Accumulated load time lag becomes noticeable. I am looking for a way to eliminate lookups on non-existent files and directories.
One solution I can think of is to create links like
ln -s /usr/lib/x86_64-linux-gnu/perl/5.30/Time /etc/perl/TimeThis solution sounds a bit scary. It would require creating dozens of links (one per package) and it would be dependent on the the distribution package management, which may change during upgrades. I am looking for something safer, something more ... standard (?)
LD_PRELOAD environment variable comes to mind but I am not at that level to fully understand how to correctly use it.
Perl seems to have no default /etc configuration, at least not the way many other linux software use it. So this is my predicament.