Unable to run Perl scripts in Cron as www after updating

After I have updated lang/perl5.20 to 5.20 using PKGNG I am now receiving the following error on all the cron jobs that run perl scripts as the www user:

Can't locate operating_systems.pm:   Permission denied at /usr/local/www/awstats/cgi-bin/awstats.pl line 2258.

Can't locate common.pl:   Permission denied at /usr/local/www/lightsquid/lightparser.pl line 36.

The Cron job is:

@hourly /usr/local/www/lightsquid/lightparser.pl today #LigthSquid
@hourly /usr/local/bin/perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=saturn -update #Update Webstats


root@saturn:~ # head /usr/local/www/lightsquid/lightparser.pl
# LightSquid Project (c) 2004-2005 Sergey Erokhin aka ESL

Interesting thing is, it works fine if I run it interactively as www:

su -m www -c '/usr/local/www/lightsquid/lightparser.pl today'

root@saturn:~ # su -m www -c '/usr/local/bin/perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=saturn -update'
Create/Update database for config "/usr/local/etc/awstats/awstats.saturn.conf" by AWStats version 7.4 (build 20150714)
From data in log file "/var/log/httpd-access.log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 657112)
Jumped lines in file: 657112
 Found 657112 already parsed records.
Parsed lines in file: 59
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 59 new qualified records.
Upgrading to lang/perl5.20 might have changed permissions on some of the directories for your Perl modules.

perl -V | awk '/@INC/,/\.$/'

perl -e 'use operating_system; print "ok\n"'

You might want to check to make sure that the location of the Perl module and the folders leading to it are readable by all.
readable and executable.

Those problem files are not part of perl 5.20 ? Are they searched from PATH perhaps? Try adding your PATH to crontab.


That latter part was rubbish.
I tried adding the path:

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin; /usr/local/www/lightsquid/lightparser.pl today

That still did not work:

Can't locate common.pl:   Permission denied at /usr/local/www/lightsquid/lightparser.pl line 36.

So I decided to try this instead:

cd /usr/local/www/lightsquid; /usr/local/www/lightsquid/lightparser.pl today

That worked. I'd still like to know why this broke? Or if this simply resolved a symptom of a much larger problem.
I think you should ask, why it worked before the perl upgrade. Those modules must be in
/usr/local/www/lightsquid and somehow perl found them earlier. Did you change user accounts or home directories while upgrading ?