Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Perl app won't compile /run from cron

by haukex (Archbishop)
on May 23, 2018 at 21:48 UTC ( [id://1215115]=note: print w/replies, xml ) Need Help??


in reply to Perl app won't compile /run from cron

Try the command perldoc -l Image::Grab to show you where the module got installed, I'm guessing that that path isn't one of the @INC directories listed at the top of your post. Setting the right PATH isn't always enough if you've got custom entries added to @INC via something like the PERL5LIB environment variable, because then that environment variable needs to be set in the environment that cron provides to the programs it runs. I'm still just guessing, but probably that isn't the case and the environment provided by cron is different from the one you have on the command line. For example, are you using local::lib? If you want to see the difference, try running this command from both the command line and from a crontab entry: perl -le 'die "$ENV{PERL5LIB} @INC\n"'

If those are different, then it depends on how you're changing @INC for the best way to solve this. If you could report back with the results of the above, we can probably help more.

Replies are listed 'Best First'.
Re^2: Perl app won't compile /run from cron
by dazz (Beadle) on May 25, 2018 at 08:35 UTC
    Hi I tried  perldoc -l Image::Grab but I don't have perldoc installed.
    I am not using local::lib.
    I used the cron commmand
    * * * * * /usr/bin/perl /home/user/perl_script.pl 1 2>&1 | /usr/bin/ +logger -t test_cron
    to get the compiler error output from syslog.

    Dazz
      I am not using local::lib.

      Based on the pathname ~/perl5/lib/perl5 and that you say you used cpan to install the module, I'm pretty sure you are using local::lib. The cpan client, when run without sudo, will usually detect that it doesn't have permissions to write to the system directories and autoconfigure to use local::lib. If you check your .profile or .bashrc files, you should see variables like PERL_LOCAL_LIB_ROOT and PERL5LIB being set there, these would have been added there by local::lib, and as I said those are the variables that are probably missing from the environment that cron provides, hence my suggestion to try and set PERL5LIB explicitly.

      I tried perldoc -l Image::Grab but I don't have perldoc installed.

      Well, you could do sudo apt-get install perl-doc, but did you try dave_the_m's suggestion, which should work even without perldoc? I also made a few other suggestions and asked a few questions above as well as here.

      I tried perldoc -l Image::Grab but I don't have perldoc installed.
      locate Image/Grab.pm

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-16 16:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found