Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Trouble finding modules from cron

by cbeckley (Curate)
on Apr 11, 2017 at 16:41 UTC ( #1187662=note: print w/replies, xml ) Need Help??


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

Replies are listed 'Best First'.
Re^2: Trouble finding modules from cron
by faineant (Beadle) on Apr 11, 2017 at 18:47 UTC

    This worked!

    use FindBin; use lib "$FindBin::Bin/../path/to/modules";

    Thank you!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1187662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2020-05-26 23:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (152 votes). Check out past polls.

    Notices?