Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Trouble finding modules from cron

by cbeckley (Curate)
on Apr 11, 2017 at 16:41 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1187662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-24 20:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found