goblinfart has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I'm trying to set up the cronjobs for bugzilla on redhat linux 7.0 with perl 5.6.0 and my question is: the line /var/www/html/bugztest/whineatnews.pl attempts to execute the script but does not find the required files which the script references b/c they are in the /var/www/html/bugztest/ directory. The error I get speaks of some @INC variable where the paths are referenced. If I don't want to place copies of the required files in the current path, how can I point the path to /var/www/html/bugztest/ Thanks in advance, goblinfart

Replies are listed 'Best First'.
Re: crontab and @INC
by lemming (Priest) on Feb 07, 2001 at 00:39 UTC
Re: crontab and @INC
by Hot Pastrami (Monk) on Feb 07, 2001 at 00:41 UTC
    You can use the lib pragma in your script to specify the path:

    use lib '/var/www/html/bugztest/'; use someModuleInThatPath;
    ... or set your OS's PERL5LIB environment variable to include the directories you want Perl to search.

    Hot Pastrami
      Thanks for the tips! I ended up adding this: -I/var/www/html/bugztest/ to this: #!/usr/bonsaitools/bin/perl i.e. !/usr/bonsaitools/bin/perl -w -I/var/www/html/bugztest/ in the perl files that I wanted to run with crontab. A very cut and paste solution, not really sure exactly what its doing, but it worked! Thanks again, goblinfart

        What it's doing is adding /var/www/html/bugztest to the @INC directory, which tells Perl where to look for modules.

        As an aside: wrap your code in <code> and </code> tags, it makes it more readable!

        HTH

        Philosophy can be made out of anything. Or less -- Jerry A. Fodor