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!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.