Hi Monks!
My code runs fine, I can even run it from the browser and it does what it is supposed do to, but I can’t get it to work running from a “cron job”, I tried everything, I had the "DBStuff.pm” locally, meaning in the same directory level as the “check.pl”, now I have it inside of "lib" directory, but it is still giving me this error:
Can't locate DBStuff.pm in @INC (@INC contains: .. /etc/perl /usr/loca
+l/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5
/usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/li
+b/site_perl .) at /home/mysite.com/cgi-bin/scripts/check.pl line 10.
BEGIN failed--compilation aborted at /home/mysite.com/cgi-bin/scripts/
+check.pl line 10.
The directory structure looks like this:
..
/cgi-bin
/lib/ DBStuff.pm
/scripts/ check.pl
..
Here is the part of the code:
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw(escapeHTML);
use Data::Dumper;
use Date::Calc qw( Today_and_Now );
use lib '..'; # Add private library to path
use DBStuff; ####>>>>>>>>>>>>>> This is my line 10
use MyLib::Log qw(do_log);
if ($@) {
warn "Cron job failed: $@\n";
}
my $q = new CGI;
$| = 1;
BEGIN
{
my $log_error = 'error.txt';
use CGI::Carp qw(carpout);
# Send all warnings to the log_file
open STDERR, '>>', $log_error;
}
...
Any suggestions?
Thanks for looking!