Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by Random_Walk (Prior)
on May 24, 2018 at 08:44 UTC ( [id://1215138]=note: print w/replies, xml ) Need Help??


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

It looks like you are missing the path to your library in your @INC array within Perl. You can add a line to your script to explicitly use the library directory where Image::Grab is installed.

use lib '/var/local/perl-site/';
Or where ever it may be. It is strange that it is not in a standard system patch though if it is installed with cpan. Do you know the directory where Grab.pm is installed?

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!

Replies are listed 'Best First'.
Re^2: Perl app won't compile /run from cron
by dazz (Beadle) on May 24, 2018 at 11:05 UTC
    Hi Grab is located:
    darren@trackcam3:~ $ find ~/ -name Grab /home/darren/.cpan/build/Image-Grab-1.4.2-gwMQYz/lib/Image/Grab /home/darren/.cpan/build/Image-Grab-1.4.2-gwMQYz/blib/lib/Image/Grab /home/darren/.cpan/build/Image-Grab-1.4.2-gwMQYz/blib/lib/auto/Image/G +rab /home/darren/.cpan/build/Image-Grab-1.4.2-gwMQYz/blib/arch/auto/Image/ +Grab /home/darren/perl5/lib/perl5/arm-linux-gnueabihf-thread-multi-64int/au +to/Image/Grab /home/darren/perl5/lib/perl5/Image/Grab
    Image::Magick is installed here:
    /usr/lib/arm-linux-gnueabihf/perl5/5.24/Image/Magick /usr/lib/arm-linux-gnueabihf/perl5/5.24/auto/Image/Magick
    This is a headless server so having libraries splattered around isn't helpful. Looking back at my notes, CPAN installed the modules in my home dir. The Ubuntu packages were installed in /usr.

    Dazz

      "This is a headless server so having libraries splattered around isn't helpful"

      Then don't do that. If you are using the system perl and a package is available in apt, use that, otherwise you need to install things in the right place (sudo cpanm Image::Grab), or (as detailed in other replies you already have) specify the correct paths for your cron jobs for where you have installed things.

        Hi
        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.
        I have just run  sudo cpan BLOB, the other module not found. It is installed in /usr/local/share/perl/5.24.1/BLOB
        Installing the modules as root has fixed the problem. The perl compiler can now find the modules by default.

        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.


        Dazz

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-26 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found