http://www.perlmonks.org?node_id=1187662


in reply to Trouble finding modules from cron

@INC is where perl looks for modules. Perl populates that array from several sources, including the environment variable $PERL5LIB.

Perhaps you have $PERL5LIB set in your environment? This might be what's going on since it works for you but not for cron.

If that's the case, you could set the variable in the crontab entry, however, I prefer to do something like this in the calling script:

use FindBin; use lib "$FindBin::Bin/../path/to/modules";
This assumes your modules are reliably in the same relative location with respect to your scripts.

Otherwise you could just use the path directly, although this makes me itch a little:

use lib "/full/path/to/modules";

Hope this helps.

Thanks,
cbeckley