in reply to Perl @INC Error

cron is likely to run under a different user account, with different file permissions and different environment variables.

Check which user cron is running under and make sure they have permission to read GD/Graph/hbars.pm, as well as read and execute permission on the directories "above" that on the filesystem.

See if you can find any differences in the environment variables between your account and cron's account, especially the PERL5LIB and PERL5OPT variables.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Replies are listed 'Best First'.
Re^2: Perl @INC Error
by frozenwithjoy (Priest) on Aug 15, 2013 at 15:22 UTC
    To follow up on your suggestion, I recommend that zee3b put the following in a cron job:
    * * * * * echo $PERL5LIB * * * * * echo $PERL5OPT

    And if one isn't as expected just set the appropriate variable in crontab (but above any cron jobs).

      Another solution is to call the script in the cron this way:

      bash -l -c "perl /path/to/script.pl"

      With that you assure that the environment is build like the one you have on the console, where you tested your perl script.

      McA