"I didn't intentionally install the modules in the home directory but even if I did, I am trying to run a cron perl script as user (not root). So perl should have configured itself to do that by default. "
This would be undesirable behaviour. Users without appropriate permissions should not be able to install things system wide. Fortunately for us as users the tools provide this useful feature under the hood to take care of this. If you read cpanm and local::lib you'll understand what they do.
"So modules installed with CPAN in the home user directory aren't found when the script is run as user by cron. That's a bug."
I appreciate why you may think so, but this is not the case, it isn't a bug. If you take a step back and think about this from the perspective of security and a multi user system, this is how it's supposed to work. The alternative options described in other responses would also have worked.
In reply to Re^5: Perl app won't compile /run from cron
by marto
in thread Perl app won't compile /run from cron
by dazz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |